Really simple program to preload into Nucleo boards to drive messages on the LCD shield for Ada Lovelace Day in ARM Sheffield
Diff: main.cpp
- Revision:
- 0:59256585cc71
--- /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