Nur Khairunnisha Zainal / Mbed 2 deprecated UserButton

Dependencies:   mbed

Committer:
nishayi
Date:
Mon May 06 23:32:15 2019 +0000
Revision:
0:386021451960
Sample Code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nishayi 0:386021451960 1 #include "mbed.h"
nishayi 0:386021451960 2
nishayi 0:386021451960 3 DigitalIn mybutton(PC_13); DigitalOut myled(PA_5);
nishayi 0:386021451960 4
nishayi 0:386021451960 5 int main()
nishayi 0:386021451960 6 {
nishayi 0:386021451960 7 while(1)
nishayi 0:386021451960 8 {
nishayi 0:386021451960 9 if (mybutton == 0) // Button is pressed
nishayi 0:386021451960 10 myled = 1;
nishayi 0:386021451960 11 else // Button is NOT pressed
nishayi 0:386021451960 12 myled = 0;
nishayi 0:386021451960 13 }
nishayi 0:386021451960 14 }