我正在使用 arduino mega 来控制 iRobot Create 我已经成功地通过 OI 命令更改模式和运行 Create 的演示,但我无法让它做任何特定的事情,比如驾驶或播放声音。它根本不响应这些命令。
int led=13;
void setup()
{
pinMode(led, OUTPUT);
delay(2000);
Serial.begin(57600);
sendCom((byte[]){128,131}); // start-> full mode
//sendCom((byte[]){136,0}); // this works, tells Create to play demo 0
sendCom((byte[]){137,255,56,1,244}); // supposed to make Create drive backward, but doesn't do anything
}
void loop()
{
int _speed=1000;
digitalWrite(led, HIGH);
delay(_speed);
digitalWrite(led, LOW);
delay(_speed);
}
void sendCom(byte toSend[]){
int length=sizeof(toSend)/sizeof(byte);
for (int i=0;i<length;i++) Serial.write(toSend[i]);
Serial.flush();
}