/* Using Arduino for Citizen Science! Project 1: Simple Digital Sensors Connect one lead of simple digital sensor (e.g. pushbutton or tilt switch) to the sensorPin and the other lead to GND. Written by jenfoxbot <jenfoxbot@gmail.com> Code is MIT license (non-commercial open-source) */ //Set up our (global) variables to store the sensor pin // and the sensor reading int sensorPin = 13; int sensorReading; void setup() { // put your setup code here, to run once: //Initialize the serial monitor (aka "window" into Arduino board) Serial.begin(9600); //Tell the Arduino what pin(s) to use pinMode(sensorPin, INPUT); } void loop() { // put your main code here, to run repeatedly: //1) Read the status of the sensor (1 = signal, 0 = no signal) sensorReading = digitalRead(sensorPin); //2) Print the sensor value Serial.println(sensorReading); //3) Add a small delay so we can keep up w/ those readings delay(100); }