Digital Input simple example for WIZwiki-W7500 academy

Dependencies:   mbed

Fork of DigitalIn_HelloWorld_WIZwiki-W7500 by Lawrence Lee

main.cpp

Committer:
joon874
Date:
2015-07-02
Revision:
11:8955f95f2c2c
Parent:
10:108881ce024e
Child:
13:f6b0834008ee

File content as of revision 11:8955f95f2c2c:

/* Digital Input Example Program */

#include "mbed.h"

DigitalIn  mypin(D10); // change this to the button on your board
DigitalOut myled(LED1);

int main()
{
    // check mypin object is initialized and connected to a pin
    if(mypin.is_connected()) {
        printf("mypin is connected and initialized! \n\r");
    }
    
    // Optional: set mode as PullUp/PullDown/PullNone/OpenDrain
    mypin.mode(PullNone); 
    
    // press the button and see the console / led change
    while(1) {
        printf("mypin has value : %d \n\r", mypin.read());
        myled = mypin; // toggle led based on value of button
        wait(0.25);
    }
}