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.
example.cpp@0:329ba18c901d, 2011-01-10 (annotated)
- Committer:
- nelsonoliveira
- Date:
- Mon Jan 10 21:23:15 2011 +0000
- Revision:
- 0:329ba18c901d
- Child:
- 1:30e3abd959e2
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| nelsonoliveira | 0:329ba18c901d | 1 | /* |
| nelsonoliveira | 0:329ba18c901d | 2 | * DISCLAIMER: I hereby place this code in public domain. |
| nelsonoliveira | 0:329ba18c901d | 3 | * This library should be considered not fit for production, and I present no warranties |
| nelsonoliveira | 0:329ba18c901d | 4 | * that it is fit for any intent or purpose, use it at your own risk. |
| nelsonoliveira | 0:329ba18c901d | 5 | * |
| nelsonoliveira | 0:329ba18c901d | 6 | * Nelson Oliveira |
| nelsonoliveira | 0:329ba18c901d | 7 | */ |
| nelsonoliveira | 0:329ba18c901d | 8 | |
| nelsonoliveira | 0:329ba18c901d | 9 | #include "mbed.h" |
| nelsonoliveira | 0:329ba18c901d | 10 | #include "SparkfunSerialLCD.h" |
| nelsonoliveira | 0:329ba18c901d | 11 | |
| nelsonoliveira | 0:329ba18c901d | 12 | //Declares a SparkFun Serial LCD on mbed pin 13 |
| nelsonoliveira | 0:329ba18c901d | 13 | SparkfunSerialLCD LCD(p13); |
| nelsonoliveira | 0:329ba18c901d | 14 | |
| nelsonoliveira | 0:329ba18c901d | 15 | int main() |
| nelsonoliveira | 0:329ba18c901d | 16 | { |
| nelsonoliveira | 0:329ba18c901d | 17 | LCD.Backlight(29); //Ajdusts backlight to max |
| nelsonoliveira | 0:329ba18c901d | 18 | LCD.setCursor(4,0); //Initial cursor place |
| nelsonoliveira | 0:329ba18c901d | 19 | LCD.print("SparkFun"); |
| nelsonoliveira | 0:329ba18c901d | 20 | LCD.setCursor(6,1); //Cursor place on second line |
| nelsonoliveira | 0:329ba18c901d | 21 | LCD.print("LCD"); |
| nelsonoliveira | 0:329ba18c901d | 22 | |
| nelsonoliveira | 0:329ba18c901d | 23 | wait(2); //Leaves message on screen for 2 seconds |
| nelsonoliveira | 0:329ba18c901d | 24 | |
| nelsonoliveira | 0:329ba18c901d | 25 | while (1) //Eternal loop |
| nelsonoliveira | 0:329ba18c901d | 26 | { |
| nelsonoliveira | 0:329ba18c901d | 27 | LCD.cls(); //Clear screen |
| nelsonoliveira | 0:329ba18c901d | 28 | for (int i=0;i<255;i++) //Simple repetition until 255 |
| nelsonoliveira | 0:329ba18c901d | 29 | { |
| nelsonoliveira | 0:329ba18c901d | 30 | LCD.setCursor(0,0); //Position cursor on the beginning of the first line |
| nelsonoliveira | 0:329ba18c901d | 31 | LCD.printf("Loop: %d",i); //Writes the current FOR count overwriting the previous text |
| nelsonoliveira | 0:329ba18c901d | 32 | } |
| nelsonoliveira | 0:329ba18c901d | 33 | } |
| nelsonoliveira | 0:329ba18c901d | 34 | } |