This is car control simulation by using Mbed controller and real time operating system.
Dependencies: MCP23017 Servo WattBob_TextLCD mbed-rtos mbed
Fork of Ass3 by
CommonVariable.h@13:e5b22bfbe67b, 2014-05-07 (annotated)
- Committer:
- muaiyd
- Date:
- Wed May 07 10:25:50 2014 +0000
- Revision:
- 13:e5b22bfbe67b
- Parent:
- 11:7f2414ecb7ee
Final Version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
muaiyd | 13:e5b22bfbe67b | 1 | /*********************************** |
muaiyd | 13:e5b22bfbe67b | 2 | * CommonVariable.h * |
muaiyd | 13:e5b22bfbe67b | 3 | ************************************/ |
muaiyd | 0:68ce46607848 | 4 | #ifndef COMMON_VARIABLE_H |
muaiyd | 0:68ce46607848 | 5 | #define COMMON_VARIABLE_H |
muaiyd | 0:68ce46607848 | 6 | #include "MCP23017.h" |
muaiyd | 0:68ce46607848 | 7 | #include "WattBob_TextLCD.h" |
muaiyd | 0:68ce46607848 | 8 | #include "mbed.h" |
muaiyd | 1:b409ad65466a | 9 | #include "Servo.h" |
muaiyd | 0:68ce46607848 | 10 | |
muaiyd | 11:7f2414ecb7ee | 11 | static Servo SpeedShow_Servo(p21); // Use pin 21 to control the servo |
muaiyd | 0:68ce46607848 | 12 | static MCP23017 Port(p9,p10,0x40) ; // 16-bit object with I2C Chip MCP23017 |
muaiyd | 0:68ce46607848 | 13 | static WattBob_TextLCD LCD(&Port); // A 2*16 chacater LCD object |
muaiyd | 13:e5b22bfbe67b | 14 | //Input and Output ports |
muaiyd | 1:b409ad65466a | 15 | static BusOut OverSpeedLED(LED1 , LED2 , LED3 , LED4); |
muaiyd | 1:b409ad65466a | 16 | static DigitalIn EngineSwitch(p5); |
muaiyd | 7:a92da438d06c | 17 | static DigitalOut R_Side_Light(p27); |
muaiyd | 7:a92da438d06c | 18 | static DigitalOut L_Side_Light(p28); |
muaiyd | 7:a92da438d06c | 19 | static DigitalOut R_Side_Indicator(p29); |
muaiyd | 7:a92da438d06c | 20 | static DigitalOut L_Side_Indicator(p30); |
muaiyd | 13:e5b22bfbe67b | 21 | static DigitalIn L_Light_Switch(p6); |
muaiyd | 13:e5b22bfbe67b | 22 | static DigitalIn R_Light_Switch(p7); |
muaiyd | 13:e5b22bfbe67b | 23 | static DigitalIn L_Indicator_Switch(p15); |
muaiyd | 13:e5b22bfbe67b | 24 | static DigitalIn R_Indicator_Switch(p16); |
muaiyd | 1:b409ad65466a | 25 | static AnalogIn Accelerometer(p19); |
muaiyd | 1:b409ad65466a | 26 | static AnalogIn Brake(p20); |
muaiyd | 0:68ce46607848 | 27 | |
muaiyd | 1:b409ad65466a | 28 | extern const uint8_t MaxSpeed; |
muaiyd | 13:e5b22bfbe67b | 29 | //Inpout Data Variable |
muaiyd | 1:b409ad65466a | 30 | extern bool EngineStat; |
muaiyd | 1:b409ad65466a | 31 | extern bool IsOverSpeed; |
muaiyd | 13:e5b22bfbe67b | 32 | extern bool R_LightSide_SW; |
muaiyd | 13:e5b22bfbe67b | 33 | extern bool L_LightSide_SW; |
muaiyd | 13:e5b22bfbe67b | 34 | extern bool R_Indicator_SW; |
muaiyd | 13:e5b22bfbe67b | 35 | extern bool L_Indicator_SW; |
muaiyd | 1:b409ad65466a | 36 | extern float Accelerometer_Value; |
muaiyd | 1:b409ad65466a | 37 | extern float Brake_Value; |
muaiyd | 13:e5b22bfbe67b | 38 | |
muaiyd | 1:b409ad65466a | 39 | extern uint8_t Speed[3]; |
muaiyd | 1:b409ad65466a | 40 | extern uint8_t Average_Speed; |
muaiyd | 1:b409ad65466a | 41 | extern float Odometer_Value; |
muaiyd | 1:b409ad65466a | 42 | extern uint8_t Counter; |
muaiyd | 1:b409ad65466a | 43 | |
muaiyd | 0:68ce46607848 | 44 | #endif |