summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 736b949..84b5b85 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3,17 +3,46 @@
#include "rgb.h"
#include "oled.h"
#include "Buzzer.h"
+#include "motors.h"
RGB rgb;
BUZZER buzzer;
+MOTORS motors; // speed 80 is prefered, because of higher input voltage (5V -> 3.7V after H-bridge), motor is rated for 3V
+ // in practice, speed below 70 dosn't even work.
void setup()
-{}
+{
+ rgb.init();
+ buzzer.init();
+ motors.init();
+
+}
void loop()
{
+ rgb.setColorRGB(0, 255, 0, true);
+ motors.forward(100, 2000);
+ delay(1000);
+ rgb.setColorRGB(255, 0, 0, true);
+ motors.backward(100, 2000);
+ delay(1000);
+ rgb.setColorRGB(0, 255, 255, true);
+ motors.leftTurn(100, 2000);
+ delay(1000);
+ rgb.setColorRGB(255, 255, 0, true);
+ motors.rightTurn(100, 2000);
+ delay(1000);
+
+ motors.rightForward(100, 2000);
+ delay(1000);
+ motors.rightBackward(100, 2000);
+ delay(1000);
+ motors.leftForward(100, 2000);
+ delay(1000);
+ motors.leftBackward(100, 2000);
+ delay(1000);
// buzzer.playMelody(happy, 8);
// delay(1000);