Hausaufgaben3 Lösung: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Die Seite wurde neu angelegt: „<div style="width:1200px; height:300px; overflow:auto; border: 2px solid #088"> <pre> →Deklaration: #include "AlphaBot.h" // Arduino Bibl…“ |
Keine Bearbeitungszusammenfassung |
||
| Zeile 6: | Zeile 6: | ||
AlphaBot Alf = AlphaBot(); // Instanz des AphaBot wird erzeugt | AlphaBot Alf = AlphaBot(); // Instanz des AphaBot wird erzeugt | ||
const byte GESCHWINDIGKEIT_u8 = 90; // Geschw. wählbar: 0 - 255; Min: 80 | |||
void setup() | void setup() | ||
{ | { | ||
// Wird einmalig beim Start ausgeführt | // Wird einmalig beim Start ausgeführt | ||
Alf.SetSpeed( | Alf.SetSpeed(GESCHWINDIGKEIT_u8); // Geschw. setzen: 0 - 255 | ||
} | } | ||
| Zeile 21: | Zeile 18: | ||
{ | { | ||
// Wird zyklisch ausgeführt | // Wird zyklisch ausgeführt | ||
delay(1000); | for (int i=0; 4; i++) { | ||
Alf.Forward(1000); // Geradeausfahrt | |||
Alf.Brake(); // STOP | |||
delay(1000); // Für 1 s | |||
Alf.RightCircle(400); // AlphaBot dreht sich für 1s nach rechts | |||
Alf.Brake(); | |||
delay(1000); // Für 1 s | |||
} | |||
} | } | ||
</pre> | </pre> | ||
</div> | </div> | ||
Version vom 17. März 2022, 17:53 Uhr
/* Deklaration */
#include "AlphaBot.h" // Arduino Bibliothek einbinden
AlphaBot Alf = AlphaBot(); // Instanz des AphaBot wird erzeugt
const byte GESCHWINDIGKEIT_u8 = 90; // Geschw. wählbar: 0 - 255; Min: 80
void setup()
{
// Wird einmalig beim Start ausgeführt
Alf.SetSpeed(GESCHWINDIGKEIT_u8); // Geschw. setzen: 0 - 255
}
void loop()
{
// Wird zyklisch ausgeführt
for (int i=0; 4; i++) {
Alf.Forward(1000); // Geradeausfahrt
Alf.Brake(); // STOP
delay(1000); // Für 1 s
Alf.RightCircle(400); // AlphaBot dreht sich für 1s nach rechts
Alf.Brake();
delay(1000); // Für 1 s
}
}
→ zurück zum Hauptartikel: Termin 3