document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. //Created by Olivia De Masi - week 13 - Fab Academy 2020
  2.  
  3. int TouchPin=2;                 // Touch sensor connected to digital pin 2
  4.  
  5. void setup() {  
  6.   pinMode(TouchPin, INPUT);           // Set pin 2 as an input
  7.   Serial.begin(9600);                 // Start serial communication at 9600 bps
  8. }
  9.  
  10. void loop() {
  11.  if (digitalRead(TouchPin) == HIGH){  // If sensor is ON,
  12.   Serial.write(1);                    // send 1 to Serial port
  13.   } else {                            // If the sensor is OFF,
  14.     Serial.write(0);                  // send 0 to Serial port
  15.   }
  16.  
  17. }
');