mbed base board 2016 Check program check for SD card read&write (3 switches, 6 leds, I2C LCD, SD card)
Dependencies: SDFileSystem mbed
Fork of SDFileSystem_HelloWorld by
Revision 2:0ee1c0236a11, committed 2016-10-26
- Comitter:
- tamaki
- Date:
- Wed Oct 26 08:13:51 2016 +0000
- Parent:
- 1:a41c274f95e2
- Commit message:
- mbed base board 2016 Check program check for SD card read&write (3 switches, 6 leds, I2C LCD, SD card)
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a41c274f95e2 -r 0ee1c0236a11 main.cpp --- a/main.cpp Mon Oct 17 00:20:38 2016 +0000 +++ b/main.cpp Wed Oct 26 08:13:51 2016 +0000 @@ -1,8 +1,8 @@ -#define CPP1 0 -#define C1 1 - +#define CPP1 1 +#define C1 0 #if CPP1 +//SD card check program C++ version #include "mbed.h" #include "SDFileSystem.h" #include "ACM1602NI.h" @@ -42,9 +42,11 @@ cChkSw::cChkSw(PinName s1, PinName s2, PinName s3) { + //Create instance SW1,SW2,SW3 sw1 = new DigitalIn(s1); sw2 = new DigitalIn(s2); sw3 = new DigitalIn(s3); + //All SW pin set Pull Up sw1->mode(PullUp); sw2->mode(PullUp); sw3->mode(PullUp); @@ -88,7 +90,6 @@ int main() { char str[80]; - lcd.cls(); lcd.locate(0,0); lcd.printf("SD Card chkpgm"); @@ -150,6 +151,7 @@ #endif #if C1 +//SD card check program C version // // // @@ -163,6 +165,7 @@ DigitalOut led4(p24); DigitalOut led5(p25); DigitalOut led6(p26); +//Create instance SW1,SW2,SW3 DigitalIn sw1(p14); DigitalIn sw2(p15); DigitalIn sw3(p16); @@ -212,8 +215,12 @@ int main() { char str[80]; - - + +//All SW pin set Pull Up + sw1.mode(PullUp); + sw2.mode(PullUp); + sw3.mode(PullUp); + lcd.cls(); lcd.locate(0,0); lcd.printf("SD Card chkpgm"); @@ -226,7 +233,6 @@ while(1){ chksw(); led6 = 1; - if(sw_st[0] == 1){ led1=led2=led3=led4=led5=led6 = 0; led4 = 1;