Hello,
I'm new in Arduino and I would make a chronograph to measure de speed of a ball of Airsoft ( scuze me, I'm french, my English is very bad ).
But I have a problem because the serial monitor nothing display. I'm sure that I have all connected and I have do a another program to verify the serial monitor and all running fine.
Can you help me ?
Have a good day .
there is a forum in French if you don't feel comfortable in English
.
Please correct your post above and add code tags around your code: [code]`` [color=blue]// your code is here[/color] ``[/code].
It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)
what are your sensors? should they be declared as INPUT_PULLUP?
why do you have delay(800);it's useless and you might get new interrupts
you should do your math for data in a critical section, blocking the interrupts alternatively, if you are sure that sensor2 is always after sensor1, you could do the math within sensor2 ISR.
are you 2 sensors are 6cm apart?data = 0.06 / ((time2 - time1) / 1000000.0); // v = s / t
you might want to make data a float or an unsigned long and simplify the maths to perform integer maths data = 60000UL / (time2 - time1); // vitesse = distance / temps = 0.06 / ((time2 - time1) / 1000000.0);