implementing a matlab function in simulink to get the distance from an ultrasonic sensor
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am trying to use the matlab function block in simulink to get the distance from an ultrasonic , I used the HC-SR04 Add-On Library for Arduino this was my function
function [distance,time_c] = ultrasonic(trig,echo)
a = arduino('COM13','Uno','libraries','JRodrigoTech/HCSR04');
sensor = addon(a,'JRodrigoTech/HCSR04',trig,echo);
time_c = readTravelTime(sensor);
distance = readDistance(sensor);
end
however it seems that I can't build the arduinon object inside the function how can I achive that ?
I am new to this , if you have a link that can help
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Modeling in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!