Arduino Programmierung mit MATLAB: Unterschied zwischen den Versionen

Aus HSHL Mechatronik
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
 
(3 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 3: Zeile 3:
* [https://www.mathworks.com/help/matlab/arduinoio-get-started-with-matlab-support-package-for-arduino-hardware.html?s_tid=CRUX_lftnav Getting Started]
* [https://www.mathworks.com/help/matlab/arduinoio-get-started-with-matlab-support-package-for-arduino-hardware.html?s_tid=CRUX_lftnav Getting Started]
* [https://www.mathworks.com/help/matlab/supportpkg/using-arduino-explorer.html Arduino Explorer App]
* [https://www.mathworks.com/help/matlab/supportpkg/using-arduino-explorer.html Arduino Explorer App]
* [https://www.mathworks.com/help/matlab/supportpkg/getting-started-with-matlab-support-package-for-arduino-hardware.html Erste Schritte mit MATLAB]
* [https://de.mathworks.com/help/matlab/supportpkg/arduinoio.ultrasonic.html Ultraschallsensor einlesen]
== Nützliche Befehle ==
* <code>>> arduinoExplorer</code>
== Musterlösung ==
close all; clc; % Initialisierung
if ~isobject(hArduino)
  hArduino = arduino('COM5','Uno') % Verbindung aufbauen
end
tic % Timer starten
for i=1:100
    Spannung(i)= readVoltage(hArduino,'A0');
    Zeit(i)    = toc;
    pause(0.1) % in s
end
plot(Zeit,Spannung,'r.-')
xlabel('Zeit in s')
ylabel('Spannung in V')
----
→ zurück zum Hauptartikel: [[BSE Angewandte Informatik - SoSe24]]

Aktuelle Version vom 17. April 2024, 11:33 Uhr

Inhalt

Nützliche Befehle

  • >> arduinoExplorer

Musterlösung

close all; clc; % Initialisierung

if ~isobject(hArduino)

 hArduino = arduino('COM5','Uno') % Verbindung aufbauen

end tic % Timer starten for i=1:100

   Spannung(i)= readVoltage(hArduino,'A0');
   Zeit(i)    = toc;
   pause(0.1) % in s

end

plot(Zeit,Spannung,'r.-') xlabel('Zeit in s') ylabel('Spannung in V')


→ zurück zum Hauptartikel: BSE Angewandte Informatik - SoSe24