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.
Dependencies: TextLCD mbed-rtos mbed
Fork of ELEC_350_CourseWork by
main.cpp@0:8f564feffdd8, 2017-11-25 (annotated)
- Committer:
- thomasmorris
- Date:
- Sat Nov 25 15:39:56 2017 +0000
- Revision:
- 0:8f564feffdd8
- Child:
- 1:e21c07d7c3a3
Version_1.0; Working LCD
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| thomasmorris | 0:8f564feffdd8 | 1 | #include "mbed.h" |
| thomasmorris | 0:8f564feffdd8 | 2 | #include "Led.h" |
| thomasmorris | 0:8f564feffdd8 | 3 | #include "rtos.h" |
| thomasmorris | 0:8f564feffdd8 | 4 | #include "TextLCD.h" |
| thomasmorris | 0:8f564feffdd8 | 5 | |
| thomasmorris | 0:8f564feffdd8 | 6 | Led GreenLed(D5); |
| thomasmorris | 0:8f564feffdd8 | 7 | TextLCD lcd(A0, A1, A2, A3, A4, A5,TextLCD::LCD16x2); // rs, e, d4-d7 Sets up LCD |
| thomasmorris | 0:8f564feffdd8 | 8 | float TimeBase = 0.5; |
| thomasmorris | 0:8f564feffdd8 | 9 | Thread LCD; |
| thomasmorris | 0:8f564feffdd8 | 10 | float LDR = 1.5; |
| thomasmorris | 0:8f564feffdd8 | 11 | void LCD_Thread() |
| thomasmorris | 0:8f564feffdd8 | 12 | { |
| thomasmorris | 0:8f564feffdd8 | 13 | lcd.printf("LDR Value is %1.1f \n",LDR); |
| thomasmorris | 0:8f564feffdd8 | 14 | } |
| thomasmorris | 0:8f564feffdd8 | 15 | int main() |
| thomasmorris | 0:8f564feffdd8 | 16 | { |
| thomasmorris | 0:8f564feffdd8 | 17 | |
| thomasmorris | 0:8f564feffdd8 | 18 | LCD.start(LCD_Thread); |
| thomasmorris | 0:8f564feffdd8 | 19 | GreenLed.switchOff(); |
| thomasmorris | 0:8f564feffdd8 | 20 | while(1) |
| thomasmorris | 0:8f564feffdd8 | 21 | { |
| thomasmorris | 0:8f564feffdd8 | 22 | GreenLed.Toggle(); |
| thomasmorris | 0:8f564feffdd8 | 23 | wait(TimeBase); |
| thomasmorris | 0:8f564feffdd8 | 24 | } |
| thomasmorris | 0:8f564feffdd8 | 25 | } |
