This is for our FYDP project. 2 MPU6050s are used
Diff: robot/robot.cpp
- Revision:
- 3:47461d37adfb
- Parent:
- 0:21019d94ad33
diff -r 7b3822eacad8 -r 47461d37adfb robot/robot.cpp --- a/robot/robot.cpp Sat Mar 21 22:44:36 2015 +0000 +++ b/robot/robot.cpp Sun Mar 22 00:43:42 2015 +0000 @@ -7,6 +7,8 @@ HC05 bt(TX_BT,RX_BT,EN_BT); +Servo myservo(PTA12); //PTD0 + AnalogIn irL(IR_L); AnalogIn irC(IR_C); AnalogIn irR(IR_R); @@ -29,7 +31,7 @@ TB6612 MotorB(MOT_PWMB_PIN, MOT_BIN1_PIN, MOT_BIN2_PIN); Motors motors( &MotorA, &MotorB, MOT_STBY_PIN); -nRF24L01P rf(PTD2, PTD3, PTD1, PTD0, PTC17, PTD2); // mosi, miso, sck, csn, ce, irq //CSN has been changed from PTD5 to PTC17 +nRF24L01P rf(PTD2, PTD3, PTD1, PTD2, PTC17, PTD2); // mosi, miso, sck, csn, ce, irq //CSN has been changed from PTD5 to PTC17 bool send_flag; //indicates when robot should send all data @@ -40,6 +42,8 @@ unsigned long long long_time = 0; Timer t; +//Timer t_m; //Timer for the motor +time_t prev = 0; //previous time for the motor float getTime() { return (float)(long_time + t.read_us())/1000000 ; } @@ -69,5 +73,6 @@ LED_OFF //good to go t.start(); //start timer + //t_m.start(); }