hello_mbot_motor
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
hello_mbot_motor [2025/02/03 14:41] – angelegt torsten.roehl | hello_mbot_motor [2025/02/03 15:08] (aktuell) – torsten.roehl | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Hello mBot Motor ====== | ====== Hello mBot Motor ====== | ||
+ | //Dieses **Arduino-Programm** steuert die Motoren des mBot und lässt ihn sich abwechselnd in entgegengesetzte Richtungen drehen. Die Motoren am Port **M1** und **M2** laufen mit einer Geschwindigkeit von ±100 (maximaler Wert: ±255). Nach 500 ms wechselt die Drehrichtung, | ||
Zeile 7: | Zeile 8: | ||
<Code c linenums:1 | Listing 1: | <Code c linenums:1 | Listing 1: | ||
+ | #include < | ||
+ | MeDCMotor motor1(M1); | ||
+ | MeDCMotor motor2(M2); | ||
+ | |||
+ | void setup(){} | ||
+ | |||
+ | void loop() { | ||
+ | // | ||
+ | motor1.run(-100); | ||
+ | motor2.run(100); | ||
+ | delay(500); | ||
+ | motor1.run(100); | ||
+ | motor2.run(-100); | ||
+ | delay(500); | ||
+ | motor1.stop(); | ||
+ | motor2.stop(); | ||
+ | delay(1000); | ||
+ | } | ||
</ | </ | ||
hello_mbot_motor.1738593667.txt.gz · Zuletzt geändert: 2025/02/03 14:41 von torsten.roehl