dsfa

Dependencies:   dsf SDFileSystem TextLCD mbed stepper_moter

Fork of my_example_Nucleo_Ex05_SD_zhangyuxiang2 by liang brain

Revision:
3:1e51c10aa4f2
Parent:
2:1c1602268656
Child:
4:c88bf297ee75
--- a/main.cpp	Thu May 03 10:36:22 2018 +0000
+++ b/main.cpp	Thu May 03 10:53:02 2018 +0000
@@ -1,14 +1,15 @@
 #include "mbed.h"
+#include "TextLCD.h"
 #include "SDFileSystem.h"
 
-// mosi, miso, sclk, name     用SPI端口
-//SDFileSystem sd(PB_15, PB_14, PB_13, PA_9, "sd"); 
-//Serial pc(PA_2, PA_3);
-SDFileSystem sd(PA_7, PA_6, PA_5, PA_15, "sd");                                 //教学板上的管脚
-Serial pc(PA_9, PA_10);                                                         //教学板上与电脑通讯的串口
+//LCD显示屏  rs,     e,    d4-d7,                    model
+TextLCD lcd(PC_13, PC_14, PC_15, PA_0, PA_1, PA_4, TextLCD::LCD20x4); // rs, e, d4-d7, model  V4版本
+    
+//SD卡          mosi, miso, sclk, cs,    name     用SPI端口
+SDFileSystem sd(PB_15, PB_14, PB_13, PB_12, "sd");                                 
+Serial pc(PA_9, PA_10);                                                         //与电脑通讯的串口
 
-int main()
-{
+int main() {
     DirHandle *dh = opendir("/sd/");    //读取SD卡中的文件列表
     if(!dh){
         pc.printf("opendir error\n");
@@ -54,4 +55,32 @@
     //pc.printf("card type is 0x%x\r\n" , sd.card_type());
 
     return 0;
+
+
+    lcd.printf("Hello World!");
+    wait_ms(1000); //等待1秒
+    lcd.cls(); //清屏
+    
+    for(int i=0; i<10000; i+=4){
+        lcd.locate(0,0); //分别控制起始的列和行,从0开始
+        lcd.printf("%d", i);
+        wait_ms(1000); //等待1秒
+        
+        lcd.locate(0,1);
+        lcd.printf("%d", i+1);
+        wait_ms(1000);
+        
+        lcd.locate(0,2);
+        lcd.printf("%d", i+2);
+        wait_ms(1000);
+        
+        lcd.locate(0,3);
+        lcd.printf("%d", i+3);
+        wait_ms(1000);
+        
+        lcd.cls(); //清屏
+    }
+
+    
+
 }