Compare commits

..

No commits in common. "6cf254fa5531d9dd3e1d6c3fc36194ef5f9660ff" and "ea508bebc83ad7d9c95d2ab8151ab784b4be557d" have entirely different histories.

View File

@ -17,22 +17,11 @@ int motor_pin4 = 11; // Orange - 28BYJ48 pin 4
// Motor variables // Motor variables
int motor_speed = 1200; int motor_speed = 1200;
int motor_count = 0; int motor_count = 0;
int motor_count_max = 64; int motor_count_max = 256;
int motor_lookup[8] = {B01000, B01100, B00100, B00110, B00010, B00011, B00001, B01001}; 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) void setup(void)
{ {
current_state = STATE_CONNECTING;
Serial.begin(9600); Serial.begin(9600);
Serial.println("Started"); Serial.println("Started");
@ -69,28 +58,15 @@ void setup(void)
carrier.display.fillScreen(0x000); carrier.display.fillScreen(0x000);
current_state = STATE_LOGGED_OUT; // Pinouts for motor
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_pin1, OUTPUT);
pinMode(motor_pin2, OUTPUT); pinMode(motor_pin2, OUTPUT);
pinMode(motor_pin3, OUTPUT); pinMode(motor_pin3, OUTPUT);
pinMode(motor_pin4, OUTPUT); pinMode(motor_pin4, OUTPUT);
//do NOT add code after this. DON'T DO IT.
} }
void loop(void) void loop(void)
{ {
carrier.Buttons.update();
// Rotate motor if needed // Rotate motor if needed
if (motor_count) { if (motor_count) {
motor_clockwise(); motor_clockwise();
@ -110,26 +86,8 @@ void loop(void)
motor_count = motor_count_max; 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() void motor_clockwise()
{ {
for (int i = 7; i >= 0; i--) { for (int i = 7; i >= 0; i--) {