Digital Input simple example for WIZwiki-W7500 academy

Dependencies:   mbed

Fork of DigitalIn_HelloWorld_WIZwiki-W7500 by Lawrence Lee

Committer:
joon874
Date:
Thu Jul 02 07:37:01 2015 +0000
Revision:
11:8955f95f2c2c
Parent:
10:108881ce024e
Child:
13:f6b0834008ee
Digital Input example for WIZwiki-W7500 Academy

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joon874 11:8955f95f2c2c 1 /* Digital Input Example Program */
joon874 11:8955f95f2c2c 2
mbed_official 0:aaf5a9d465fd 3 #include "mbed.h"
mbedAustin 5:fa65447e171b 4
joon874 10:108881ce024e 5 DigitalIn mypin(D10); // change this to the button on your board
mbedAustin 5:fa65447e171b 6 DigitalOut myled(LED1);
mbedAustin 5:fa65447e171b 7
mbedAustin 5:fa65447e171b 8 int main()
mbedAustin 5:fa65447e171b 9 {
mbedAustin 8:ef3558374977 10 // check mypin object is initialized and connected to a pin
mbedAustin 7:64e67ec4441e 11 if(mypin.is_connected()) {
mbedAustin 5:fa65447e171b 12 printf("mypin is connected and initialized! \n\r");
mbedAustin 5:fa65447e171b 13 }
mbedAustin 5:fa65447e171b 14
mbedAustin 7:64e67ec4441e 15 // Optional: set mode as PullUp/PullDown/PullNone/OpenDrain
mbedAustin 8:ef3558374977 16 mypin.mode(PullNone);
mbedAustin 5:fa65447e171b 17
mbedAustin 5:fa65447e171b 18 // press the button and see the console / led change
mbed_official 0:aaf5a9d465fd 19 while(1) {
mbedAustin 5:fa65447e171b 20 printf("mypin has value : %d \n\r", mypin.read());
mbedAustin 5:fa65447e171b 21 myled = mypin; // toggle led based on value of button
mbed_official 0:aaf5a9d465fd 22 wait(0.25);
mbed_official 0:aaf5a9d465fd 23 }
mbedAustin 5:fa65447e171b 24 }
joon874 10:108881ce024e 25
joon874 10:108881ce024e 26
joon874 10:108881ce024e 27
joon874 10:108881ce024e 28
joon874 10:108881ce024e 29
joon874 10:108881ce024e 30
joon874 10:108881ce024e 31
joon874 10:108881ce024e 32
joon874 10:108881ce024e 33
joon874 10:108881ce024e 34
joon874 10:108881ce024e 35
joon874 10:108881ce024e 36
joon874 10:108881ce024e 37
joon874 10:108881ce024e 38
joon874 10:108881ce024e 39
joon874 10:108881ce024e 40
joon874 10:108881ce024e 41
joon874 10:108881ce024e 42
joon874 10:108881ce024e 43
joon874 10:108881ce024e 44
joon874 10:108881ce024e 45
joon874 10:108881ce024e 46