if (inchCm == 0)
distanceBetweenSensors = 200; // Distance between sensors is 2.00 inches
else
distanceBetweenSensors = 508; // Distance between sensors is 2.00 inches (or 5.08 cm)
startNanoSec();
while(g_menuMode == MENUMODE_PHOTO)
{
unsigned long startTime;
unsigned long endTime;
unsigned long impactTime;
if (readSensorDigitalFast(0) == lowHigh) // If sensor1 detects projectile
{
startTime = nanoSec();
// Look for sensor2 to detect projectile
@@@@@@@@@@@@@@@@@@@
i search in internet
the arduino cant calculate the time in nanosecond so how this person could use ARDUINO UNO R3 to calculate the Time From Sensor Signal
and can some one explain this code in menu01_projectile.ino how it work
The nanoSec() function is defined in cameraAxe_helperFuncs.ino.
////////////////////////////////////////
// Function: nanoSec - Returns the nanosecond count (similar to micro, but more precission and 4 times faster)
// Parameters:
// None
// Returns:
// Number of micros seconds in timer0
////////////////////////////////////////
extern volatile unsigned long timer0_overflow_count;
unsigned long nanoSec()
{
return (((timer0_overflow_count << 8) + TCNT0)*500);
}
The "<<" part is a bit shift. The BitMath tutorial is very good at explaining this; certainly worth the time to read it and understand it.
The TCNT0 part is the timer/counter register. That's a bit advanced, but you can here's a good tutorial on AVR timers.
Suffice it to say that that the purpose of their method of timing is just a lot of optimization of code to make the CameraAxe as efficient as possible in its timing.
directly to arduino input digital pin with out use the Camera Axe 5 Shield
Yes you could, but then the burden of making it work would be up to you. The Camera Axe makes use of special software to calculate the timing accurately. Normally the digitalRead method is too slow for accurate timing, as is the micros() function. The Camera Axe library has special methods that provide very fast-responding digital read, as well as nanosecond timing information.
The Optoisolator chip provides electrical isolation between inputs and outputs. Internally it uses an LED and a phototransistor to decouple the input from the output. It protects the camera axe from the high voltages sometimes present in cameras and especially in flashes. (Some older flashes put as much as 300 volts through their sync terminals.) The Optoisolator also serves to protect the Camera Axe from those high voltages.
I'm not sure what the 4050 buffer chip is used for. I'd have to look at the schematic to be sure. It is a TTL driver, so it outputs more current than CMOS, and may be used to drive higher power components in a circuit. It will also serve as a voltage translator and signal cleanup. It can convert slow-rising input signals to square wave, and input voltages of 3 to 15 VDC to the supply voltage (usually +5VDC)