Go Down

Topic: beep when flash is charge up - registers flash (Read 373 times) previous topic - next topic


Hi. i was Trying to detect when my photo flash went of.. so arudino could tell me when to take next photo with more flash power. in lack of LDR (light dependet resistor) i chose to try a photo resistor in stead. one like this:
I used digital pin instead of Analog pin. and it register much good.

Here are my code and how i set it up.

 photo diode
 long pin to 10k resistor pin A and long pin to Ardunio digital pin 2
 shor pin to 5v

 the 10k resistor
 Pin A to gnd
 pin B to photo diod long pin

 pizo transduser 4Khz
 Black wire to gnd
 red wire to Digital pin 8.

 the code:
Code: [Select]
const int button = 2;//
int chargeTime=8000;
int hz=2600;
int buttonState = 0;

void setup() {
  pinMode(button, INPUT);

void loop() {
  buttonState = digitalRead(button);
  if (buttonState == HIGH)
  {// if 1
    tone(8,hz,100);hz=hz-26;if (hz<0)hz=0;
  {// if not 1// just do nothing}

Go Up