/* This code was written for the Stitch the Loop e-textiles curriculum by the Exploring Computer Science e-textiles team. ECS 2018 GPL V3 for non commercial use. ECS 2018 CC- BY NC SA. */ /* ◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇ This program is a starter you will need to add code. This code will not compile as is. ◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇ */ /* STUDENT META HERE STUDENT NAME(S) Date Written Brief description of what program does here. */ // The first section is where to declare global objects and call up additional files the program needs to use. int led1 = 0; //Name your LEDs so you can easily keep track of them int led2 = 1; int switch1 = 21; //Name your switches (switch1, switch2; leftswitch, rightswitch; etc.). //Add in your second switch here. void setup() { // The second section is for things that only need to be done once at the beginning of the program. Serial.begin(9600); //start serial connection pinMode(switch1, INPUT); //configure your switch as an input //set your second switch to an input pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); //set the remaing LEDs to OUTPUTS //If you need to program a negative side be sure to set that to OUTPUT as well! } void loop() { /* The third section is for things that happen repeatedly in the program loop while the program is running. The code is executed in the order coded. */ int switch1storage = digitalRead(switch1); //tell the computer to read the information from switch1 //It will store that information in the variable called "switch1storage" (name it something else if you want) //read the information from the second switch here Serial.println(switch1storage); //print out the value of the pushbutton Serial.println(switch2storage); if (switch1storage == HIGH && switch2storage == HIGH) { //so if both switches are off, do this lighting pattern blinkingPattern1(); } /*add in your other two conditionals here. The whole thing should read: "if"{ } , "else if" { } "else if" { }, and "else" */ else { //you do not need conditions here, it's just "else" blinkingPattern2(); } } // The fourth section is for functions that are called up by the third section. void blinkingPattern1(){ //here is one sample lighting pattern that turns all the lights off. digitalWrite(led1, LOW); digitalWrite(led2, LOW); digitalWrite(led3, LOW); digitalWrite(led4, LOW); digitalWrite(led5, LOW); } //add in your other blinking patterns. type "void patternName () { }"