20x4 LCD with SRM32F407

Dependencies:   mbed TextLCD

Files at this revision

API Documentation at this revision

Comitter:
suntopbd
Date:
Mon Jan 13 04:36:25 2020 +0000
Parent:
2:ad0b044d0a10
Commit message:
ok

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r ad0b044d0a10 -r 15d08fd609ec TextLCD.lib
--- a/TextLCD.lib	Sat Dec 04 11:31:07 2010 +0000
+++ b/TextLCD.lib	Mon Jan 13 04:36:25 2020 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/simon/code/TextLCD/#e4cb7ddee0d3
+https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
diff -r ad0b044d0a10 -r 15d08fd609ec main.cpp
--- a/main.cpp	Sat Dec 04 11:31:07 2010 +0000
+++ b/main.cpp	Mon Jan 13 04:36:25 2020 +0000
@@ -3,8 +3,54 @@
 #include "mbed.h"
 #include "TextLCD.h"
 
-TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7
+TextLCD lcd(PC_15, PC_13, PC_14, PE_6, PE_4, PE_2,TextLCD::LCD20x4); // rs, e, d4-d7
+AnalogIn   adcPB0(PB_0);
+AnalogIn adcPB1(PB_1);
+AnalogOut dacPA5(PA_5); 
+DigitalIn buttonPA0 (PA_0);
+DigitalIn extbutton1PE5 (PE_5);
+DigitalIn extbutton2PE3 (PE_3);
+DigitalOut rLED(PD_14);   // on board red LED, DO
+DigitalOut bLED(PD_15);   // on board blue LED. DO
+DigitalOut gLED(PD_12);   // on board green LED, DO
+DigitalOut oLED(PD_13);   // on board orange LED, DO
+
+DigitalOut exRef(PE_7);   // on board orange LED, DO
+
+
+
+uint32_t adcval=0;
+uint16_t val=0;
+
 
 int main() {
-    lcd.printf("Hello World!\n");
+    dacPA5=0.0f;
+    extbutton1PE5.mode(PullUp);
+    extbutton2PE3.mode(PullUp);
+    exRef=1;
+    
+    while(1)
+    {
+        lcd.cls();
+    lcd.printf("mbed with STM32F407G");
+    lcd.printf(" !! It Worked !!\n");
+    if(dacPA5<1.00f)
+    dacPA5 = dacPA5+0.002442f;
+    adcval=0;
+    for(int i=0;i<4096;i++)
+    {
+    adcval= adcval + 4095*adcPB1.read_u16()/65535; // 12 bit value
+    }
+    val=adcval/4096;
+    lcd.printf("  ADC on PB1: %d\n", val);
+    lcd.printf("AREF Volts: %f",(2.9464*val/4095));
+   wait(.25);
+   rLED =extbutton1PE5.read();
+   bLED =extbutton2PE3.read();
+   gLED =!extbutton1PE5.read();
+   oLED =!extbutton2PE3.read();
+   while(buttonPA0)
+   {}
+   
+    }
 }
diff -r ad0b044d0a10 -r 15d08fd609ec mbed.bld
--- a/mbed.bld	Sat Dec 04 11:31:07 2010 +0000
+++ b/mbed.bld	Mon Jan 13 04:36:25 2020 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file