![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
LED comes on if pin5 is on!
Diff: main.cpp
- Revision:
- 0:9606eb1f663f
diff -r 000000000000 -r 9606eb1f663f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Sep 06 14:57:58 2010 +0000 @@ -0,0 +1,29 @@ +#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; + } + } +} \ No newline at end of file