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: SDFileSystem mbed
Fork of PES4_Programme by
Diff: source/main.cpp
- Revision:
- 59:1867088695f3
- Parent:
- 58:cda5298c9b7f
- Child:
- 60:7554e4272b3b
--- a/source/main.cpp Thu Apr 05 09:53:43 2018 +0000 +++ b/source/main.cpp Thu Apr 05 13:45:45 2018 +0000 @@ -1,11 +1,14 @@ #include "main.h" - +#define FADESPEED 5 +#define DEMOTIME 5 int state = 44; int oldState; Serial pc(USBTX, USBRX); // tx, rx +DigitalIn lichtschranke(PC_5); + /* PWM Test Tool */ int channel; int dutyCycle; @@ -13,6 +16,11 @@ int moment; s_user user[2]; +/* Demo Tool */ +uint32_t color = 0; +int colorTime = 0; +int r,b,g; + int main() { pc.baud(460800); @@ -188,6 +196,44 @@ writeMedication(0,user[1]); state = 47; break; + case 55: + /* Demo Tool */ + color = 0x0055AA; + while(colorTime < DEMOTIME) { + for(r = 0; r <= 255;r++){ + color &= 0x00FFFF; + color &= (r<<4); + wait_ms(FADESPEED); + } + for(b = 255; b >= 0; b--){ + color &= 0xFFFF00; + color &= b; + wait_ms(FADESPEED); + } + for(g = 0; g <= 255; g++){ + color &= 0xFF00FF; + color &= (g<<2); + wait_ms(FADESPEED); + } + for(r = 255; r > 0; r--) { + color &= 0x00FFFF; + color &= (r<<4); + wait_ms(FADESPEED); + } + for(b = 0; b <= 255; b++) { + color &= 0xFFFF00; + color &= b; + wait_ms(FADESPEED); + } + for (g = 255; g > 0; g--) { + color &= 0xFF00FF; + color &= (g<<2); + wait_ms(FADESPEED); + } + colorTime++; + } + + break; default: state = 47; /* Go to State Switch */ break;