car using PID from centre line
Dependencies: FRDM-TFC mbed CBuffer XBEE mbed_angular_speed motor2 MMA8451Q
Fork of KL25Z_Camera_Test by
Diff: main.h
- Revision:
- 45:3435bdd2d487
- Parent:
- 43:649473c5a12b
- Child:
- 46:6806ea59ffed
--- a/main.h Mon Mar 20 12:23:34 2017 +0000 +++ b/main.h Thu Mar 23 09:36:39 2017 +0000 @@ -3,7 +3,7 @@ #define CAM_DIFF 10 #define WHEEL_RADIUS 0.025f #define RIGHT_MOTOR_COMPENSATION_RATIO 1.1586276 -#define USE_COMMS 0 +#define USE_COMMS 1 #define CLOSE_CAMERA TFC_LineScanImage0 #define LOOKAHEAD_CAMERA TFC_LineScanImage1 @@ -127,3 +127,21 @@ float oldTime; int lapNo; + +//Accelerometer: +float checkAcc(); + +#if defined (TARGET_KL25Z) || defined (TARGET_KL46Z) + PinName const SDA = PTE25; + PinName const SCL = PTE24; +#elif defined (TARGET_KL05Z) + PinName const SDA = PTB4; + PinName const SCL = PTB3; +#elif defined (TARGET_K20D50M) + PinName const SDA = PTB1; + PinName const SCL = PTB0; +#else + #error TARGET NOT DEFINED +#endif + +#define MMA8451_I2C_ADDRESS (0x1d<<1)