/* 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 an EXAMPLE of the many possible solutions. This code will compile as is. ◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇ */ /* STUDENT META HERE STUDENT NAME(S) Date Written Brief description of what program does here. */ /* One patch of aluminum foil should be connected to 12 (A11), 6 (A7), 9 (A9) or 10 (A10). The other patch should be connected to a ground (GND) Adjust the code for your A-pin, upload, and read the serial monitor to see the values. */ // The first section is where to declare global objects and call up additional files the program needs to use. int aluminumFoil = A11; //select your input pin for your sensor int foilStorage; //this name (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. // initialize serial communication at 9600 bits per second: // this allows messages to be sent to the computer Serial.begin(9600); pinMode(aluminumFoil, INPUT); //sets sensor to input digitalWrite(aluminumFoil, HIGH); //initializes the sensor } 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 foilStorage = analogRead(aluminumFoil); // read the input on analog pin 0: Serial.println(foilStorage); // print out the value you read: (literally, "print line") delay(100); // delay in between reads for stability } // The fourth section is for functions that are called up by the third section.