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
Revision 0:b487734d687d, committed 2018-10-16
- Comitter:
- mbentata
- Date:
- Tue Oct 16 14:31:19 2018 +0000
- Commit message:
- RTOS Lab code
Changed in this revision
diff -r 000000000000 -r b487734d687d 4DGL-uLCD-SE.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/4DGL-uLCD-SE.lib Tue Oct 16 14:31:19 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/4180_1/code/4DGL-uLCD-SE/#2cb1845d7681
diff -r 000000000000 -r b487734d687d main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 16 14:31:19 2018 +0000 @@ -0,0 +1,75 @@ +#include "mbed.h" +#include "uLCD_4DGL.h" +#include "rtos.h" +#include "stdio.h" + +uLCD_4DGL uLCD(p13,p14,p30); +PwmOut RGBLED_r(p23); +PwmOut RGBLED_g(p24); +PwmOut RGBLED_b(p25); +Mutex lcd_mutex; + + +void thread1(void const *args) +{ + while(true) { // thread loop + RGBLED_r = 0.5 + (rand() % 11)/20.0; + RGBLED_g = 0.5 + (rand() % 11)/20.0; + RGBLED_b = 0.5 + (rand() % 11)/20.0; + Thread::wait(300); // wait 1.5s + } +} + +void thread2(void const *args) +{ + while(true) { // thread loop + lcd_mutex.lock(); + // basic printf demo = 16 by 18 characters on screen + uLCD.printf("\nHello uLCD World\n"); //Default Green on black text + uLCD.printf("\n Starting Demo..."); + uLCD.text_width(4); //4X size text + uLCD.text_height(4); + uLCD.color(RED); + for (int i=10; i>=6; --i) { + uLCD.locate(1,2); + uLCD.printf("%2D",i); + wait(.5); + } + uLCD.cls(); + lcd_mutex.unlock(); + Thread::wait(1000); + } +} + + +void thread3(void const *args) +{ + while(true) { // thread loop + lcd_mutex.lock(); + // basic printf demo = 16 by 18 characters on screen + uLCD.printf("\nHello uLCD World\n"); //Default Green on black text + uLCD.printf("\n Starting Demo..."); + uLCD.text_width(4); //4X size text + uLCD.text_height(4); + uLCD.color(RED); + for (int i=5; i>=0; --i) { + uLCD.locate(1,2); + uLCD.printf("%2D",i); + wait(.5); + } + uLCD.cls(); + lcd_mutex.unlock(); + Thread::wait(1000); + } +} + +int main() { + Thread t1(thread1); + Thread t2(thread2); + Thread t3(thread3); + while(1) { + lcd_mutex.lock(); + lcd_mutex.unlock(); + Thread::wait(500); + } +}
diff -r 000000000000 -r b487734d687d mbed-rtos.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Tue Oct 16 14:31:19 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/mbed_official/code/mbed-rtos/#5713cbbdb706
diff -r 000000000000 -r b487734d687d mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 16 14:31:19 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file