esempio IR
Dependencies: mbed
main.cpp
- Committer:
- vidica94
- Date:
- 2017-02-18
- Revision:
- 0:1a9d324dc172
- Child:
- 1:58b121ccca27
File content as of revision 0:1a9d324dc172:
#include "mbed.h" /* This basic example just shows how to read the output value of a infrared sensor. In this case we used the sensor avaiable on amazon link we want to read the output value as a digital signal , so we can use the InterruptIn to better control the bot. WARNING: it's necessary to calibrate the ir sensor, using the little trimmer on the pcb whith the sensors. To calibrate the sensors run the other program */ DigitalIn ir(D4);// definition of the pin D4 as digital input DigitalOut led(LED1);//definition of the green led on the board as digital output int main() { while(1) { printf("lettura = %d\n",ir.read() ); if(ir.read()==1) led = 1; else led=0; wait(1.0); } }