![](/media/cache/group/11700697_10200701668420946_8214886085951071495_o.jpg.50x50_q85.jpg)
mobile robot control with artificial hormones
Dependencies: Communication_Robot RTC-DS1307 iSerial mbed
Fork of Andante_v00 by
main.cpp
- Committer:
- soulx
- Date:
- 2015-03-01
- Revision:
- 3:12f2ee26a43f
- Parent:
- 2:b31c4677ebc0
- Child:
- 4:42dc950d54f4
File content as of revision 3:12f2ee26a43f:
#include "mbed.h" #include "param.h" #include "pin_config.h" #include "iSerial.h" //#include "protocol.h" #include "communication.h" //control stearing PwmOut heading_front(PIN_FRONT_SERVO); PwmOut heading_rear(PIN_REAR_SERVO); //control speed PwmOut drive_motor(PIN_RC_SPEED); //led debugging DigitalOut myled(LED1); //set foreground Ticker Update_command; Ticker Samping; void Init_servo() { heading_front.period_ms(20); heading_rear.period_ms(20); drive_motor.period_ms(20); } void setControl() { } void getSensor() { } void Init_foreground() { Update_command.attach(&setControl,TIMER_UPDATE); Samping.attach(&getSensor,TIMER_SAMPING); } int main() { myled=0; //Init communication serial 2chanal COMMUNICATION pan_a(TX_PAN_A, RX_PAN_A,115200,1000,1000); // tx, rx COMMUNICATION pan_b(TX_PAN_B, RX_PAN_B,115200,1000,100); // tx, rx Init_servo(); ANDANTE_PROTOCOL_PACKET packet; packet.robotId = 0xBB; packet.length = 8; packet.instructionErrorId = 0x01; packet.parameter[0] = 0x02; packet.parameter[1] = 0x03; packet.parameter[2] = 0x04; packet.parameter[3] = 0x05; packet.parameter[4] = 0x06; packet.parameter[5] = 0x07; pan_a.sendCommunicatePacket(&packet); while(1) { // if(pan_a->readable() !=0) { uint8_t status = pan_a.receiveCommunicatePacket(&packet); if(status == ANDANTE_ERRBIT_NONE) { myled =1; wait(1); myled=0; } } }