Simon Stillwell
/
LED1OnIfP5On
LED comes on if pin5 is on!
main.cpp
- Committer:
- simno
- Date:
- 2010-09-06
- Revision:
- 0:9606eb1f663f
File content as of revision 0:9606eb1f663f:
#include "mbed.h" // // This is my first go at reading DigitalIn. // If pin 5 is on, I light LED1. // Thus, running a wire from pin2 (+5v) to pin5 LED 1 comes on. // Also, running the Light Dependent Resistor (LDR) that came with my SKPANG kit // from pin2 to pin5 LED1 comes on if there is light // and goes off when the LDR is covered. // DigitalOut myled1(LED1); DigitalIn myIn5(p5); int main() { while(1) { if (myIn5) { myled1 = 1; } else { myled1 = 0; } } }