Digital Input simple example for WIZwiki-W7500 academy
Dependencies: mbed
Fork of DigitalIn_HelloWorld_WIZwiki-W7500 by
main.cpp
- Committer:
- IOP
- Date:
- 2015-07-24
- Revision:
- 14:3893c636430e
- Parent:
- 13:f6b0834008ee
- Child:
- 15:a2d578443c70
File content as of revision 14:3893c636430e:
/* Digital Input Example Program */ #include "mbed.h" DigitalOut shield_led_off(D10); // Shield LED_GREEN DigitalOut myled_R(D9); // LED_RED DigitalIn mysw(D2); // SW1 on easy module shield int main() { int sw_val; shield_led_off = 0; // Turn off Green LED on shield while(1) { sw_val = !mysw.read(); // Read Digital input value printf("Digital Input value is %d \n\r", sw_val); // output Digital Input value if(sw_val == 1){ // swich pushed, Red LED ON myled_R = 1; } else myled_R = 0; // the others, Red LED OFF wait(0.5); } }