Digital Input simple example for WIZwiki-W7500 academy

Dependencies:   mbed

Fork of DigitalIn_HelloWorld_WIZwiki-W7500 by Lawrence Lee

main.cpp

Committer:
IOP
Date:
2017-04-19
Revision:
18:4d702f3a0d0e
Parent:
17:2678f7976a04

File content as of revision 18:4d702f3a0d0e:

/* Digital Input Example Program */

#include "mbed.h"

DigitalOut myled_R(LED1);    // LED_RED on WIZwiki-W7500

DigitalIn  mysw(D10);        // push switch 

int main()
{
    int sw_val;
    
    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)     // switch pushed, Red LED ON
        {     
            myled_R = 0;
        }
        else
        {
            myled_R = 1;   // the others, Red LED OFF
        }
           
        wait(0.2);
    }
}