![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
All tasks complete
Dependencies: mbed MCP23017 mbed-rtos WattBob_TextLCD
assignment3tasks.cpp@0:0943f040009c, 2019-03-20 (annotated)
- Committer:
- aingks
- Date:
- Wed Mar 20 15:49:27 2019 +0000
- Revision:
- 0:0943f040009c
- Child:
- 1:c4f62ef9b5b7
general structure of code complete
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aingks | 0:0943f040009c | 1 | #include "header.h" |
aingks | 0:0943f040009c | 2 | //definitions of taskss |
aingks | 0:0943f040009c | 3 | //lock and unlock variables in struct whne performing calculations |
aingks | 0:0943f040009c | 4 | |
aingks | 0:0943f040009c | 5 | //pedals |
aingks | 0:0943f040009c | 6 | AnalogIn brake_pedal(pin_analog_1); |
aingks | 0:0943f040009c | 7 | AnalogIn accel_pedal(pin_analog_2); |
aingks | 0:0943f040009c | 8 | |
aingks | 0:0943f040009c | 9 | |
aingks | 0:0943f040009c | 10 | //switches |
aingks | 0:0943f040009c | 11 | DigitalIn ngene(pin_digital_1); |
aingks | 0:0943f040009c | 12 | DigitalIn leftind(pin_digital_2); |
aingks | 0:0943f040009c | 13 | DigitalIn rightind(pin_digital_3); |
aingks | 0:0943f040009c | 14 | DigitalIn sideonff(pin_digital_4); |
aingks | 0:0943f040009c | 15 | |
aingks | 0:0943f040009c | 16 | |
aingks | 0:0943f040009c | 17 | //indicators |
aingks | 0:0943f040009c | 18 | DigitalOut ngeneind(pin_LED1); |
aingks | 0:0943f040009c | 19 | DigitalOut leftind(pin_LED2); |
aingks | 0:0943f040009c | 20 | DigitalOut rightind(pin_LED3); |
aingks | 0:0943f040009c | 21 | DigitalOut sideind(pin_LED4); |
aingks | 0:0943f040009c | 22 | |
aingks | 0:0943f040009c | 23 | |
aingks | 0:0943f040009c | 24 | //RED box lights |
aingks | 0:0943f040009c | 25 | DigitalOut brakeind(pin_LED5); |
aingks | 0:0943f040009c | 26 | DigitalOut overspeedind(pin_LED6); |
aingks | 0:0943f040009c | 27 | |
aingks | 0:0943f040009c | 28 | |
aingks | 0:0943f040009c | 29 | void task1readbrake() |
aingks | 0:0943f040009c | 30 | { |
aingks | 0:0943f040009c | 31 | speedData.brakevalue = brake_pedal.read(); |
aingks | 0:0943f040009c | 32 | } |
aingks | 0:0943f040009c | 33 | |
aingks | 0:0943f040009c | 34 | void task2readaccel() |
aingks | 0:0943f040009c | 35 | { |
aingks | 0:0943f040009c | 36 | accelvalue = accel_pedal.read(); |
aingks | 0:0943f040009c | 37 | } |
aingks | 0:0943f040009c | 38 | |
aingks | 0:0943f040009c | 39 | void task3enginestate() |
aingks | 0:0943f040009c | 40 | { |
aingks | 0:0943f040009c | 41 | stateonoff = ngene.read(); |
aingks | 0:0943f040009c | 42 | } |
aingks | 0:0943f040009c | 43 | |
aingks | 0:0943f040009c | 44 | void task4average() |
aingks | 0:0943f040009c | 45 | { |
aingks | 0:0943f040009c | 46 | |
aingks | 0:0943f040009c | 47 | } |