jchipps

Setting Up: Patches

Nov 29th, 2021
1,229
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int aluminumFoil = A11; //select your input pin for your sensor. We use A11 for the analog pin.
  2. int foilStorage;  //this name (variable) stores readings from the sensor
  3.  
  4. void setup() {
  5.   // initialize serial communication at 9600 bits per second:
  6.   // this allows messages to be sent to the computer
  7.   Serial.begin(9600);
  8.   pinMode(aluminumFoil, INPUT); //sets sensor to input
  9.   digitalWrite(aluminumFoil, HIGH); //initializes the sensor
  10. }
  11.  
  12. void loop() {
  13.   int foilStorage = analogRead(aluminumFoil); // read the input on analog pin:
  14.   Serial.println(foilStorage); // print out the value you read: (literally, "print line")
  15.   delay(100);        // delay in between reads for stability
  16. }
RAW Paste Data