Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:8f6ff5bb5a2d, committed 2015-12-23
- Comitter:
- werwolf_lg
- Date:
- Wed Dec 23 16:58:19 2015 +0000
- Commit message:
- First version demo for Arduino LCD Keypad Shield and STM32 Nucleo
Changed in this revision
diff -r 000000000000 -r 8f6ff5bb5a2d TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Wed Dec 23 16:58:19 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
diff -r 000000000000 -r 8f6ff5bb5a2d main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Dec 23 16:58:19 2015 +0000
@@ -0,0 +1,57 @@
+#include "mbed.h"
+#include "TextLCD.h"
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+AnalogIn button(A0); // Init button (SELECT, LEFT, UP, DOWN, RIGHT)
+// LCD (RS, E, D4, D5, D6, D7);
+TextLCD lcd(D8, D9, D4, D5, D6, D7);
+PwmOut backlight(D10); // Backlight LCD
+DigitalOut led(LED1);
+
+int main() {
+
+ // Set backlight period and duty cycle
+ backlight.period(0.002);
+ backlight = 1;
+
+
+ lcd.cls(); // Clear LCD
+ lcd.locate(1,0); // Set locate (1 row, 2 column)
+ lcd.printf("LCD Key Shield");
+ wait(1);
+
+ int meas;
+
+ while(1) {
+ led = (led == 1) ? 0 : 1;
+
+ meas = button.read() * 1000; // Read the analog input value (value from 0.0 to 1.0) and convert to int value (from 0 to 1000)
+
+ lcd.cls();
+ lcd.locate(0,0);
+ lcd.printf("Press button");
+ lcd.locate(0,1);
+
+ if (meas < 50) {
+ lcd.printf("BUTTON: Right ");
+ backlight = 0.5; // Set 50% backlight
+ }
+ else if (meas < 210) {
+ lcd.printf("BUTTON: Up");
+ backlight = 1; // Power ON backlight
+ }
+ else if (meas < 460){
+ lcd.printf("BUTTON: Down");
+ backlight = 0; // Power OFF backlight
+ }
+ else if (meas < 720){
+ lcd.printf("BUTTON: Left");
+ }
+ else if (meas > 950){
+ lcd.printf("BUTTON: Select");
+ }
+ pc.printf("BUTTON: %4d\n", meas);
+
+ wait(0.1);
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r 8f6ff5bb5a2d mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Dec 23 16:58:19 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4336505e4b1c \ No newline at end of file