Example program for the Freetronics 16x2 LCD shield

Dependencies:   Freetronics_16x2_LCD mbed

Committer:
screamer
Date:
Fri Feb 13 09:48:28 2015 +0000
Revision:
3:392d0238a7dc
Parent:
2:4e0ed7dc6420
Update mbed library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 2:4e0ed7dc6420 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
screamer 2:4e0ed7dc6420 2 *
screamer 2:4e0ed7dc6420 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
screamer 2:4e0ed7dc6420 4 * and associated documentation files (the "Software"), to deal in the Software without
screamer 2:4e0ed7dc6420 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
screamer 2:4e0ed7dc6420 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
screamer 2:4e0ed7dc6420 7 * Software is furnished to do so, subject to the following conditions:
screamer 2:4e0ed7dc6420 8 *
screamer 2:4e0ed7dc6420 9 * The above copyright notice and this permission notice shall be included in all copies or
screamer 2:4e0ed7dc6420 10 * substantial portions of the Software.
screamer 2:4e0ed7dc6420 11 *
screamer 2:4e0ed7dc6420 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
screamer 2:4e0ed7dc6420 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
screamer 2:4e0ed7dc6420 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
screamer 2:4e0ed7dc6420 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
screamer 2:4e0ed7dc6420 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
screamer 2:4e0ed7dc6420 17 */
screamer 2:4e0ed7dc6420 18
screamer 0:4a0b425b71ff 19 #include "mbed.h"
screamer 0:4a0b425b71ff 20 #include "freetronicsLCDShield.h"
screamer 0:4a0b425b71ff 21
screamer 0:4a0b425b71ff 22 freetronicsLCDShield lcd(D8, D9, D4, D5, D6, D7, D3, A0);
screamer 0:4a0b425b71ff 23
screamer 0:4a0b425b71ff 24 int main() {
screamer 0:4a0b425b71ff 25 // turn on the back light (it's off by default)
screamer 0:4a0b425b71ff 26 lcd.setBackLight(true);
screamer 0:4a0b425b71ff 27
screamer 0:4a0b425b71ff 28 // print the first line and wait 3 sec
screamer 0:4a0b425b71ff 29 lcd.printf("mbed application");
screamer 0:4a0b425b71ff 30 wait(3);
screamer 0:4a0b425b71ff 31
screamer 0:4a0b425b71ff 32 // print the counter prefix; the number will be printed in the while loop
screamer 0:4a0b425b71ff 33 lcd.setCursorPosition(1, 0);
screamer 0:4a0b425b71ff 34 lcd.printf("counter");
screamer 0:4a0b425b71ff 35
screamer 0:4a0b425b71ff 36 int i=1;
screamer 0:4a0b425b71ff 37 while (i++) {
screamer 0:4a0b425b71ff 38 lcd.setCursorPosition(1, 8);
screamer 0:4a0b425b71ff 39 lcd.printf("%d", i);
screamer 1:cb23381652eb 40 wait(0.001);
screamer 0:4a0b425b71ff 41 }
screamer 0:4a0b425b71ff 42 }