arduino code from thursday
Virtual Cameras No Comments »/*
* Button
* by DojoDave
*
* Turns on and off a light emitting diode(LED) connected to digital
* pin 13, when pressing a pushbutton attached to pin 7.
*
* http://www.arduino.cc/en/Tutorial/Button
*/
//int ledPin = 11; // choose the pin for the LED
//int ledPin2 = 3; // choose the pin for the LED
int cameraPin = 11;
int inputPin = 4; // choose the input pin (for a pushbutton)
int val = 0; // variable for reading the pin status
int once =1;
void setup() {
pinMode(cameraPin, OUTPUT); // declare LED as output
// pinMode(ledPin2, OUTPUT); // declare LED as output
pinMode(inputPin, INPUT); // declare pushbutton as input
}
void loop(){
val = digitalRead(inputPin); // read input value
if (val == HIGH) { // check if the input is HIGH
// if (once == 1 ) {
// once = 0;
// digitalWrite(ledPin2, HIGH); // turn LED ON
digitalWrite(cameraPin, HIGH); // turn LED ON
delay(1700);
digitalWrite(cameraPin, LOW);
delay(1500);
} else {
digitalWrite(cameraPin, LOW); // turn LED ON
// digitalWrite(ledPin2, LOW); // turn LED ON
}
}