Edutech IoT Team
/
Eg7_LCD_printf
Showing use of printf on LCD
Diff: main.cpp
- Revision:
- 1:5ec6783fbc31
- Parent:
- 0:ee88f589f418
--- a/main.cpp Tue Oct 06 09:33:31 2015 +0000 +++ b/main.cpp Sat Oct 10 06:20:15 2015 +0000 @@ -1,21 +1,23 @@ -#include "mbed.h" -#include "C12832.h" +#include "mbed.h" // Basic Library required for onchip peripherals +#include "C12832.h" // Library for SPI based LCD -C12832 lcd(p5, p7, p6, p8, p11); +/* Create Objects */ +C12832 lcd(p5, p7, p6, p8, p11); // Initialize lcd object with SPI pins +/* Main Program */ int main() { int j=0; - lcd.cls(); - lcd.locate(0,3); - lcd.printf("mbed application board!"); + lcd.cls(); // Clear LCD Screen + lcd.locate(0,3); // Start from x=0 and y=3 pixels + lcd.printf("mbed application board!"); // print string on LCD while(1) { - lcd.locate(0,15); - lcd.printf("Counting : %d",j); - j++; - wait(1.0); + lcd.locate(0,15); // Start from x=0 and y=15 pixels + lcd.printf("Counting : %d",j); // Display dynamic integer update + j++; // increment j by 1 + wait(1.0); // 1 sec delay } } \ No newline at end of file