Arduino chrony - interrupts not fast enough?
so, want build device measure speed of airsoft bbs (they fly around 100-150 m/s). so, have tube, in 1 wall there ir led , on other side, there few photodiodes. bb flies through tube, crosses beam of light, casts shadow on 1 of photodiodes , sends signal arduino. there 3 photodiodes in series, 1 end connected +5v , other pin 2 on arduino nano + pull down resistor. device works fine when throw bbs through tube, registers every single 1 of them. when shoot them @ full speed, device not register anything. bbs flying fast , creating short of pulse arduino detect? how can make thing work?
this code:
this code:
code: [select]
int x = 0;
void setup() {
pinmode(2, input);
serial.begin(9600);
attachinterrupt(0, interrupt, falling);
}
void loop() {
}
void interrupt() {
x = x+1;
serial.println(x);
}
you should not using serial prints in isr.
Arduino Forum > Using Arduino > Project Guidance > Arduino chrony - interrupts not fast enough?
arduino
Comments
Post a Comment