![](/media/cache/profiles/2012_sf_avc_095.jpg.50x50_q85.jpg)
Code for autonomous rover for Sparkfun AVC. DataBus won 3rd in 2012 and the same code was used on Troubled Child, a 1986 Jeep Grand Wagoneer to win 1st in 2014.
Dependencies: mbed Watchdog SDFileSystem DigoleSerialDisp
UI/LCD/lcd.cpp@25:bb5356402687, 2018-11-30 (annotated)
- Committer:
- shimniok
- Date:
- Fri Nov 30 16:11:53 2018 +0000
- Revision:
- 25:bb5356402687
- Parent:
- 0:a6a169de725f
Initial publish of revised version.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 0:a6a169de725f | 1 | #include "mbed.h" |
shimniok | 0:a6a169de725f | 2 | /* |
shimniok | 0:a6a169de725f | 3 | void lcdInit() |
shimniok | 0:a6a169de725f | 4 | { |
shimniok | 0:a6a169de725f | 5 | lcd.baud(4800); |
shimniok | 0:a6a169de725f | 6 | lcd.printf("4800"); |
shimniok | 0:a6a169de725f | 7 | lcd.printf("%c%c", 0x7C, 13); |
shimniok | 0:a6a169de725f | 8 | lcd.baud(9600); |
shimniok | 0:a6a169de725f | 9 | lcd.printf("9600"); |
shimniok | 0:a6a169de725f | 10 | } |
shimniok | 0:a6a169de725f | 11 | |
shimniok | 0:a6a169de725f | 12 | void lcdClear() |
shimniok | 0:a6a169de725f | 13 | { |
shimniok | 0:a6a169de725f | 14 | lcd.printf("%c%c",0xFE,0x01); // command, clear |
shimniok | 0:a6a169de725f | 15 | wait(0.020); |
shimniok | 0:a6a169de725f | 16 | } |
shimniok | 0:a6a169de725f | 17 | |
shimniok | 0:a6a169de725f | 18 | void lcdSetPos(int x, int y) |
shimniok | 0:a6a169de725f | 19 | { |
shimniok | 0:a6a169de725f | 20 | uint8_t pos=0; |
shimniok | 0:a6a169de725f | 21 | |
shimniok | 0:a6a169de725f | 22 | if ( x >= 0 && x < 16 && y >= 0 && y < 2) |
shimniok | 0:a6a169de725f | 23 | pos = x + y*64; |
shimniok | 0:a6a169de725f | 24 | |
shimniok | 0:a6a169de725f | 25 | pos |= (1<<7); |
shimniok | 0:a6a169de725f | 26 | |
shimniok | 0:a6a169de725f | 27 | lcd.printf("%c%c",0xFE,pos); |
shimniok | 0:a6a169de725f | 28 | } |
shimniok | 0:a6a169de725f | 29 | |
shimniok | 0:a6a169de725f | 30 | void lcdSetSplash(const char *s1, const char *s2) |
shimniok | 0:a6a169de725f | 31 | { |
shimniok | 0:a6a169de725f | 32 | lcdClear(); |
shimniok | 0:a6a169de725f | 33 | lcd.printf(s1); |
shimniok | 0:a6a169de725f | 34 | lcdSetPos(0,1); |
shimniok | 0:a6a169de725f | 35 | lcd.printf(s2); |
shimniok | 0:a6a169de725f | 36 | lcd.printf("%c%c",0x7C,0x0A); |
shimniok | 0:a6a169de725f | 37 | } |
shimniok | 0:a6a169de725f | 38 | */ |