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: 4DGL-uLCD-SE mbed-rtos mbed
Diff: main.cpp
- Revision:
- 0:471e3038d16a
- Child:
- 1:554209140cec
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Feb 27 01:45:59 2017 +0000 @@ -0,0 +1,67 @@ +#include "mbed.h" +#include "rtos.h" +#include "RGBLed.h" +#include "uLCD_4DGL.h" + +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); +DigitalOut led4(LED4); + +RGBLed myRGBled(p23,p22,p21); //RGB PWM pins + +uLCD_4DGL uLCD(p9, p10, p11); + +Thread t1; +Thread t2; +Thread t3; +Thread t4; + +Mutex lk_LCD; + +void rgb_t3() { + while (true) { + myRGBled.write(1.0,0.0,0.0); //red + Thread::wait(2000); + myRGBled.write(0.0,1.0,0.0); //green + Thread::wait(2000); + myRGBled.write(0.0,0.0,1.0); //blue + Thread::wait(2000); + } +} + +void lcd_t1() { + while (true) { + for (int i = 0; i < 10; i++) + { + lk_LCD.lock(); + uLCD.locate(2,2); + uLCD.printf("\n Hello World! \nCount by one is %d!\n", i); + lk_LCD.unlock(); + Thread::wait(1000); + } + } +} + +void lcd_t2() { + while (true) { + for (int j = 0; j < 20; j += 2) + { + lk_LCD.lock(); + uLCD.locate(4,4); + uLCD.printf("\n Hello World! \nCount by two is %d!\n", j); + lk_LCD.unlock(); + Thread::wait(2000); + } + } +} + +int main() { + t3.start(rgb_t3); + t1.start(lcd_t1); + t2.start(lcd_t2); + while (true) { + led1 = !led1; + Thread::wait(500); + } +} \ No newline at end of file