Hardware Reference
In-Depth Information
Figure 9-2. Uno32 IR LED sensor and emmiter wiring example
The code in Listing 9-1 is loaded using MPIDE. The chipKIT Uno32 is both a listener and broadcaster. It blinks
and receives information about whether or not reflections from the IR LEDs. The code is non-blocking, so you can
simultaneously perform other actions while it is working. It is possible to operate a servo and respond to objects
detected in the front, left, or right of the sensor.
Listing 9-1. IR Object Detection Using the Task Manager Code Example
/*
* Object Detection with the Core Task Manager Service
* Determine with one sensor which where an object is
* 2 - 4 IR LEDs
* 1 IR Sensor
*/
//PIN_INT1 for the ChipKit UNO32 is Pin 2
#define pinInt PIN_INT1
 
Search WWH ::




Custom Search