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: mbed MatrixMath QEI HIDScope Matrix biquadFilter MODSERIAL FastPWM
Revision 4:4afc587630ea, committed 2019-09-10
- Comitter:
- Hendrikvg
- Date:
- Tue Sep 10 18:27:43 2019 +0000
- Parent:
- 3:68d78770639b
- Child:
- 5:dc3a076bbb10
- Commit message:
- Knippert in de kleur die je intoetst, maar bijna alles is in de flicker functie ingebouwd. Er moet een andere manier zijn.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Sep 10 15:26:58 2019 +0000
+++ b/main.cpp Tue Sep 10 18:27:43 2019 +0000
@@ -7,30 +7,33 @@
DigitalOut ledb(LED_BLUE);
Ticker ReadEnCoder;
-volatile char color;
+char color;
void flicker()
{
- ledr = !ledr;
- ledg = !ledg;
- ledb = !ledb;
+ if (color == 'r') {
+ ledr=!ledr;
+ ledg=1;
+ ledb=1;
+ }
+ if (color == 'g') {
+ ledr=1;
+ ledg=!ledg;
+ ledb=1;
+ }
+ if (color == 'b') {
+ ledr=1;
+ ledg=1;
+ ledb=!ledb;
+ }
}
int main()
{
pc.baud(115200);
- while (true)
- {
+ while (true) {
+ pc.printf("%c\n\r",color);
ReadEnCoder.attach(flicker,0.5);
color = pc.getc();
- if (color == 'r'){
- ledr=!ledr;
- }
- if (color == 'g'){
- ledg=!ledg;
- }
- if (color == 'b'){
- ledb=!ledb;
- }
}
}
\ No newline at end of file