/*
Title: Rachel Bland: 4.2.2 Sketch 4.
AltBlink: This example makes the Serial monitor show different numbers based on the button state
This example code is in the public domain.
*/
// Constants: Constants won’t change. They’re used here to set the pin numbers:
const int buttonPin = 12; // constant buttonPin assigned to pin 12
// Variables: Variables will change. They’re used do assign variable names:
int buttonState = 0;
// Setup: The setup routine runs once when you start or press reset:
void setup() { // put your setup code here, to run once
Serial.begin(9600); // initialize the Serial 9600
pinMode(buttonPin, INPUT); // initialize the LED pin as an intput
}
// Loop: The loop routine runs over and over again forever:
void loop() { // put your main code here, to run repeatedly:
buttonState = digitalRead(buttonPin);
Serial.println(buttonState); //show the Serial monitor
delay(1); // cause delay to see the change
}