diff --git a/arduino/arduino.ino b/arduino/arduino.ino index 271435d..d0563b1 100644 --- a/arduino/arduino.ino +++ b/arduino/arduino.ino @@ -19,9 +19,20 @@ int motor_speed = 1200; int motor_count = 0; int motor_count_max = 64; int motor_lookup[8] = {B01000, B01100, B00100, B00110, B00010, B00011, B00001, B01001}; +uint32_t green_led_color = carrier.leds.Color(0,255,0); + + +enum state { + STATE_CONNECTING, + STATE_LOGGED_OUT, + STATE_LOGGED_IN, + STATE_INPUT_PASSCODE, +}; +enum state current_state; void setup(void) { + current_state = STATE_CONNECTING; Serial.begin(9600); Serial.println("Started"); @@ -58,15 +69,28 @@ void setup(void) carrier.display.fillScreen(0x000); - // Pinouts for motor + current_state = STATE_LOGGED_OUT; + carrier.display.setCursor(15, 100); + carrier.display.setTextSize(2); + carrier.display.print("Press Green Button"); + carrier.leds.begin(); + carrier.leds.fill(green_led_color, 2, 1); + carrier.leds.setBrightness(5); + carrier.leds.show(); + + carrier.Buttons.begin(); + // Pinouts for motor - DO NOT ADD CODE AFTER THIS pinMode(motor_pin1, OUTPUT); pinMode(motor_pin2, OUTPUT); pinMode(motor_pin3, OUTPUT); pinMode(motor_pin4, OUTPUT); + //do NOT add code after this. DON'T DO IT. } void loop(void) { + carrier.Buttons.update(); + // Rotate motor if needed if (motor_count) { motor_clockwise(); @@ -86,8 +110,26 @@ void loop(void) motor_count = motor_count_max; } } + + switch (current_state) { + case STATE_LOGGED_OUT: + if(carrier.Buttons.onTouchDown(TOUCH2)) { + current_state = INPUT_PASSCODE; + } + break; + + default: + break; + }; + } + + + + + +//motorgøgl, pls dont touch void motor_clockwise() { for (int i = 7; i >= 0; i--) {