/* 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 led pins int aluminumFoil = A11; //name your aluminum foil patch (only the one that's connected to an "A" pin) int foilStorage; //this variable stores readings from the sensor void setup() { // The second section is for things that only need to be done once at the beginning of the program. pinMode(led1, OUTPUT); //set your led pins to OUTPUT pinMode(aluminumFoil, INPUT); //sets aluminum foil patch to INPUT digitalWrite(aluminumFoil, HIGH); //initializes the sensor Serial.begin(9600); //initializes the communication to the serial monitor } 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. */ foilStorage = analogRead(aluminumFoil); //the part of your code that reads information from the sensor Serial.println(foilStorage); //prints the value of the sensor to the serial monitor delay(100); //delay for 1/10 of a second if (foilStorage > 1000) //Set your first condition. //For instance, this might be for when nothing is touching. { LightingPattern1 (); //here is your first lighting pattern (change name as needed) } else if (foilStorage >= 970 && foilStorage <= 1000) { LightingPattern2 (); //second lighting pattern... } else //this would be for everything below the last condition { LightingPattern3 (); } } // The fourth section is for functions that are called up by the third section. void LightingPattern1(){ //put your lighting patterns into procedures digitalWrite(led1,HIGH); delay(1000); digitalWrite(led1, LOW); delay (1000); } // Maybe there should be a "LightingPqattern2" function here?