Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
/*
Camera Strobe Trigger. Triggers a strobe light when an analog input is above or below a certain level.
*/
int strobePin = 7; // Strobe
int val = 0; // To store the analog data
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
pinMode(strobePin, OUTPUT); // Sets the strobe pin to output
Serial.begin(9600); // Begins a serial connection
analogReference(DEFAULT); // Not really needed, but can help if you have a smaller solar cell etc
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
val = analogRead(0); // Reads the voltage of the solar cell
Serial.println(val); // Prints it to serial
if (val < 100){ // If the analog value is less than 100...
digitalWrite(ledPin, HIGH); // Trigger the strobe
delay(1); // Only hold the pin high for 1 millisecond, the strobe would have already triggered.
digitalWrite(ledPin, LOW); // Turn the strobe pin off
}
}