Really simple program to preload into Nucleo boards to drive messages on the LCD shield for Ada Lovelace Day in ARM Sheffield

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
MrBedfordVan
Date:
Wed Oct 05 16:40:24 2016 +0000
Commit message:
Really simple program to put on LCD Headers for ARM Sheffield Ada Lovelace Day

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
debug.h 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 000000000000 -r 59256585cc71 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Wed Oct 05 16:40:24 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/simon/code/TextLCD/#308d188a2d3a
diff -r 000000000000 -r 59256585cc71 debug.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debug.h	Wed Oct 05 16:40:24 2016 +0000
@@ -0,0 +1,16 @@
+#ifndef __DEBUG_H__
+#define __DEBUG_H__
+
+
+#ifdef DEBUG
+#define INFO(x, ...) std::printf("[INFO: %s:%d]"x"\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
+#define WARN(x, ...) std::printf("[WARN: %s:%d]"x"\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
+#define ERR(x, ...) std::printf("[ERR: %s:%d]"x"\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
+#else
+#define INFO(x, ...)
+#define WARN(x, ...)
+#define ERR(x, ...)
+#endif
+
+
+#endif
\ No newline at end of file
diff -r 000000000000 -r 59256585cc71 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 05 16:40:24 2016 +0000
@@ -0,0 +1,38 @@
+
+// Simple ARM Sheffield Ada Lovelace LCD1602 KeyPad Thing
+#include "mbed.h"
+#include "TextLCD.h"    // LCD1602
+
+// Nucleo pins
+TextLCD lcd(D8, D9, D4, D5, D6, D7);
+
+// display text on LCD
+void textLCD(char *text, int line) {
+    char tmpBuf[16];
+    for (int i = 0; i < 16; i++) tmpBuf[i] = 0x20;
+    for (int i = 0; i < strlen(text); i++) {
+        if (i < 16) tmpBuf[i] = text[i];
+        lcd.locate(i, line);
+        lcd.putc(tmpBuf[i]);
+    }
+    
+
+}
+
+int main(){
+
+    lcd.cls();
+    while(1){
+        
+           textLCD("  ARM Sheffield ", 0);
+           textLCD("Ada Lovelace Day", 1);
+           wait (10);            
+           textLCD("Not really doing", 0);
+           textLCD("much yet is it? ", 1);
+           wait (10);
+           textLCD("Try programming ", 0);
+           textLCD("it instead      ", 1);
+           wait (10);
+             
+    } // while
+}    //main
diff -r 000000000000 -r 59256585cc71 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 05 16:40:24 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4336505e4b1c
\ No newline at end of file