//Maddy McGee
int light;
int sensor;
int lastVal;
boolean on;
void setup(){
light = 2;
sensor = 14;
Serial.begin(9600);
Serial.println("Start");
pinMode(light,OUTPUT);
pinMode(sensor,INPUT);
lastVal = 0;
on = false;
}
void loop(){
int val = digitalRead(sensor);
if(lastVal==0 && val==1)
on= !on;
if(on)
digitalWrite(light,HIGH);
else
digitalWrite(light,LOW);
Serial.println(val);
lastVal = val;
}