As of now, I'm unable to get this sensor to work properly without using the delay() functions. It seems that the amount of time it takes to read data from the sensor is significant enough on the microseconds scale, and so gives me strange readings. I'm using the delayMicroseconds() function to turn the LED in the sensor on and off.
The code is pretty much exactly the same as from here, but wrapped inside a library. I control the time delay between each reading from the master sketch that I will upload to the Arduino once I figure out all the components.
I might return to figure this out without using delay(). The Arduino webpage for the delay function says that it's common to use delay for processes that take only 10's of milliseconds, so using delay() isn't a huge issue right now.
The final sensor I need to include in my prototype is the Accelerometer, which I will start writing a library for now. If I have time, I might also figure out the microphone, but half of SURF is already over and I need to start working on the Android interface and the actual box design...
No comments:
Post a Comment