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

main.cpp

Committer:
MrBedfordVan
Date:
2016-10-05
Revision:
0:59256585cc71

File content as of revision 0:59256585cc71:


// 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