DigitalIn Hello World
Fork of DigitalIn_HelloWorld_Mbed by
Use
The DigitalIn API is used to read a digital pin. The value will be either 0 or 1. Buttons and switches are some of the more common digital inputs.
API
API reference.
Import librarymbed
Diff: main.cpp
- Revision:
- 0:aaf5a9d465fd
- Child:
- 3:e2f865861a7a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Feb 13 16:09:04 2013 +0000 @@ -0,0 +1,13 @@ +#include "mbed.h" + +DigitalIn enable(p5); +DigitalOut led(LED1); + +int main() { + while(1) { + if(enable) { + led = !led; + } + wait(0.25); + } +} \ No newline at end of file