digital input example of CORE-1000
Dependencies: mbed
main.cpp@0:802145a6ea33, 2013-09-26 (annotated)
- Committer:
- gcarmonar
- Date:
- Thu Sep 26 14:35:38 2013 +0000
- Revision:
- 0:802145a6ea33
- Child:
- 1:4a3198da4fe1
digital in example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gcarmonar | 0:802145a6ea33 | 1 | #include "mbed.h" |
gcarmonar | 0:802145a6ea33 | 2 | |
gcarmonar | 0:802145a6ea33 | 3 | DigitalOut myled(LED1); |
gcarmonar | 0:802145a6ea33 | 4 | DigitalIn boton(D2); |
gcarmonar | 0:802145a6ea33 | 5 | |
gcarmonar | 0:802145a6ea33 | 6 | int main() { |
gcarmonar | 0:802145a6ea33 | 7 | while(1) { |
gcarmonar | 0:802145a6ea33 | 8 | if (boton == 0){ |
gcarmonar | 0:802145a6ea33 | 9 | myled = 1; |
gcarmonar | 0:802145a6ea33 | 10 | }else{ |
gcarmonar | 0:802145a6ea33 | 11 | myled = 0; |
gcarmonar | 0:802145a6ea33 | 12 | } |
gcarmonar | 0:802145a6ea33 | 13 | } |
gcarmonar | 0:802145a6ea33 | 14 | } |