/* 6/4/24 Connor Quigley and Reuben Poole code for the fear 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: {//moves backwards quickly digitalWrite (M2B, HIGH); digitalWrite (M2A, LOW); digitalWrite (M1B, HIGH); digitalWrite (M1A, LOW); delay (1000);//short delay to separate what comes next digitalWrite (M2B, HIGH);//turns in one direction digitalWrite (M2A, LOW); digitalWrite (M1B, LOW); digitalWrite (M1A, LOW); delay(100);//delay so it has time to turn digitalWrite (M2B, LOW);//turns back in other direction digitalWrite (M2A, LOW); digitalWrite (M1B, HIGH); digitalWrite (M1A, LOW); delay(1000);//delay to allow turn will loop and continue going backwards } { digitalWrite(32, HIGH);//turns on red and blue lights in order to make the lights purple digitalWrite(22, HIGH); digitalWrite(33, LOW); digitalWrite(1, LOW); digitalWrite(25, HIGH); digitalWrite(3, HIGH); } }