ver 2

Dependencies:   Nucleof446_input_test mbed

Fork of Nucleof446_input_test by johan yapson

Committer:
johanyapson
Date:
Mon Feb 27 08:57:56 2017 +0000
Revision:
3:7dc40c089bcf
Parent:
1:8af40c4036bf
Child:
2:287fe12e0a40
ver 2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
johanyapson 0:ac081be73cf3 1 #include "mbed.h"
johanyapson 0:ac081be73cf3 2
johanyapson 1:8af40c4036bf 3 DigitalOut myled(D3);
johanyapson 0:ac081be73cf3 4 DigitalIn input(D2);
johanyapson 0:ac081be73cf3 5
johanyapson 0:ac081be73cf3 6 int main() {
johanyapson 0:ac081be73cf3 7 while(1) {
johanyapson 0:ac081be73cf3 8 if (input)
johanyapson 0:ac081be73cf3 9 {
johanyapson 0:ac081be73cf3 10 myled = 1; // LED is ON
johanyapson 0:ac081be73cf3 11 }
johanyapson 0:ac081be73cf3 12 else
johanyapson 0:ac081be73cf3 13 {
johanyapson 0:ac081be73cf3 14 myled = 0;
johanyapson 0:ac081be73cf3 15 }
johanyapson 0:ac081be73cf3 16 // myled = 1; // LED is ON
johanyapson 0:ac081be73cf3 17 // wait(0.2); // 200 ms
johanyapson 0:ac081be73cf3 18 // myled = 0; // LED is OFF
johanyapson 0:ac081be73cf3 19 // wait(1.0); // 1 sec
johanyapson 0:ac081be73cf3 20 }
johanyapson 0:ac081be73cf3 21 }