![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
All tasks complete
Dependencies: mbed MCP23017 mbed-rtos WattBob_TextLCD
Diff: assignment3tasks.cpp
- Revision:
- 10:2b262d810c67
- Parent:
- 9:2fd97246b8f0
- Child:
- 11:d6d1583fc824
--- a/assignment3tasks.cpp Wed Mar 27 12:28:10 2019 +0000 +++ b/assignment3tasks.cpp Wed Mar 27 13:09:26 2019 +0000 @@ -248,18 +248,23 @@ void task9indLED() { - float delay = 1000 / TASKFREQ9; while(true){ - uint8_t turnleft = leftsw.read(); - uint8_t turnright = rightsw.read(); - carstateXS.lock(); + + int turnleft = leftsw; + int turnright = rightsw; - (turnleft = 1)? info.leftind = 1 :info.leftind = 0; + carstateXS.lock(); + + (turnleft = 1)? info.leftind = 1 :info.leftind = 0; // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<this lock unlock stuff is messing it up (turnright = 1)? info.rightind = 1 :info.rightind = 0; + carstateXS.unlock(); + + + //issue persists with commented code below /* if(turnleft = 1){ info.leftind = 1; } @@ -275,7 +280,7 @@ } */ - carstateXS.unlock(); + //hazard and other lights @@ -302,10 +307,13 @@ right_pulswidth = right_pulswidth / 2; } + leftind.period(left_period); leftind.pulsewidth(left_pulswidth); rightind.period(right_period); rightind.pulsewidth(right_pulswidth); + + float delay = 1000 / TASKFREQ9S2; Thread::wait((int)delay); @@ -317,4 +325,34 @@ -} \ No newline at end of file +} + +void taskXserialdump() +{ + while(true) + { + speedXS.lock(); + + PC.printf("SPEED: %.1f\r\n",speed.rawspeed); + PC.printf("BRAKE: %.1f\r\n",speed.brakevalue); + PC.printf("ACCELEROMETER: %.1f\r\n",speed.accelvalue); + + speedXS.unlock(); + + carstate.lock(); + + PC.printf("LEFT INDICATOR : %.1f\r\n",info.leftind); + PC.printf("RIGHT INDICATOR : %.1f\r\n",info.rightind); + + carstate.unlock(); + + float delay = 1000/ TASKFREQX; + Thread:: wait((int)delay); + + } + + + +} + + \ No newline at end of file