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.
Diff: main.cpp
- Revision:
- 0:ca0a38f28cbe
- Child:
- 1:c04ae2fc1a27
diff -r 000000000000 -r ca0a38f28cbe main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Mar 13 14:40:15 2014 +0000
@@ -0,0 +1,63 @@
+#include "mbed.h"
+#include "TextLCD.h"
+
+DigitalOut myled(LED1);
+
+#ifdef TARGET_KL25Z
+ // LCD (RS, E, D4, D5, D6, D7)
+ TextLCD lcd(PTA13, PTD5, PTA4, PTA5, PTC8, PTC9); // LCD Shield for Arduino (DFR00009)
+ AnalogIn button(PTB0); // board button
+#endif
+
+/***
+ * ---------------------------------------------
+ * Arduino LCD KeyPad Shield (SKU: DFR0009)
+ * ---------------------------------------------
+ * - Button : a0 -> PTB0
+ * right : < 0.15
+ * up : < 0.35
+ * down : < 0.65
+ * left : < 0.99
+ * select : ???
+ * ---------------------------------------------
+ * - DB4 : d4 -> pta4
+ * - DB5 : d5 -> pta5
+ * - DB6 : d6 -> ptc8
+ * - DB7 : d7 -> ptc9
+ * - RS : d8 -> pta13
+ * - Enable : d9 -> ptd5
+ * - Backlit Control : d10 -> ptd0
+ * ---------------------------------------------
+ * - http://www.dfrobot.com/wiki/index.php/Arduino_LCD_KeyPad_Shield_(SKU:_DFR0009)
+ * - http://www.dfrobot.com/index.php?route=product/product&keyword=DFR0009&category_id=0&description=1&model=1&product_id=51
+ * - http://www.amazon.co.jp/dp/B00ACCN148
+ * - http://akizukidenshi.com/catalog/g/gM-07029/
+***/
+
+int main()
+{
+ int count = 0;
+#ifdef TARGET_KL25Z
+ lcd.cls();
+ lcd.printf("HELLO");
+#endif
+ while (1)
+ {
+ wait(0.3);
+ myled = (myled == 1) ? 0 : 1;
+ count = count + 1;
+
+#ifdef TARGET_KL25Z
+ // READ BUTTON VALUE
+ unsigned long value = button.read_u16();
+
+ // LCD OUTPUT
+ lcd.cls();
+ lcd.locate(0,0);
+ lcd.printf("%d", count); // loop counter
+
+ lcd.locate(0,1);
+ lcd.printf("BUTTON : %04x", value); // button value
+#endif
+ }
+}