/* 6/4/24 Connor Quigley and Reuben Poole code for the happy section of the emotions challenge for our robot. */ #define M2A 17//these lines define the motors forad and backords directions and what there connected to #define M2B 16 #define M1A 19 #define M1B 18 void setup() { // put your setup code here, to run once: pinMode(32, OUTPUT);//sets these pins as outputs for the lights pinMode(33, OUTPUT); pinMode(25, OUTPUT); pinMode(22, OUTPUT); pinMode(1, OUTPUT); pinMode(3, OUTPUT); pinMode(M1A,OUTPUT);//sets the pins for the motors as outputs pinMode(M1B,OUTPUT); pinMode(M2A, OUTPUT); pinMode(M2B, OUTPUT); } void loop() { // put your main code here, to run repeatedly: {//by setting one wheel to fword and the other to backwards allows it to quickly spin in happy circles digitalWrite (M2B, LOW); digitalWrite (M2A, HIGH); digitalWrite (M1B, HIGH); digitalWrite (M1A, LOW); delay (1000);//delay to separate digitalWrite (M2B, HIGH);//spins in the other direction digitalWrite (M2A, LOW); digitalWrite (M1B, LOW); digitalWrite (M1A, HIGH); } {//this will flash between all three base collors of the LED's digitalWrite(32, HIGH);//turns on blue lights digitalWrite(22, HIGH); delay(100); digitalWrite(32, LOW);//turns of blue lights digitalWrite(22, LOW); delay(100); digitalWrite(33, HIGH);//turns on green lights digitalWrite(1, HIGH); delay(100); digitalWrite(33, LOW);//turns off green lights digitalWrite(1, LOW); delay(100); digitalWrite(25, HIGH);//turns on red lights digitalWrite(3, HIGH); delay(100); digitalWrite(25, LOW);//turns off red lights digitalWrite(3, LOW); } }