Robofun 機器人論壇

標題: 藍芽自走車無法燒入成功 [打印本頁]

作者: a87075172    時間: 2015-10-30 12:10
標題: 藍芽自走車無法燒入成功
我要做一個藍芽自走車,以下次我的程式:
int MotorRight1=5;
int MotorRight2=6;
int MotorLeft1=10;
int MotorLeft2=11;


void setup()
{  
  Serial.begin(9600);
  pinMode(MotorRight1, OUTPUT);  // 腳位 8 (PWM)
  pinMode(MotorRight2, OUTPUT);  // 腳位 9 (PWM)
  pinMode(MotorLeft1,  OUTPUT);  // 腳位 10 (PWM)
  pinMode(MotorLeft2,  OUTPUT);  // 腳位 11 (PWM)
}

void go()// 前進
{
        digitalWrite(MotorRight1,LOW);
        digitalWrite(MotorRight2,HIGH);
        digitalWrite(MotorLeft1,LOW);
        digitalWrite(MotorLeft2,HIGH);

}

void left() //右轉
{
      digitalWrite(MotorRight1,HIGH);
      digitalWrite(MotorRight2,LOW);
      digitalWrite(MotorLeft1,LOW);
      digitalWrite(MotorLeft2,HIGH);

}
void right() //左轉
{
      digitalWrite(MotorRight1,LOW);
      digitalWrite(MotorRight2,HIGH);
      digitalWrite(MotorLeft1,HIGH);
      digitalWrite(MotorLeft2,LOW);

}
void stop() //停止
{
     digitalWrite(MotorRight1,LOW);
     digitalWrite(MotorRight2,LOW);
     digitalWrite(MotorLeft1,LOW);
     digitalWrite(MotorLeft2,LOW);

}
void back() //後退
{
        digitalWrite(MotorRight1,HIGH);
        digitalWrite(MotorRight2,LOW);
        digitalWrite(MotorLeft1,HIGH);
        digitalWrite(MotorLeft2,LOW);;

}

void loop()
{
  char val = Serial.read();
  Serial.write(val);
  if (-1 != val) {
    if ('W' == val)
    go();
    else if ('A' ==val)
    left();
    else if ('D' == val)
    right();
    else if ('S' == val)
    back();
    else if ('Q' == val)
      stop();
    delay(500);
    }
  else
  {
    //stop();
    delay(500);
  }
}  


*(範例是否要變更為ArduinoIPS?)

燒入之後出現錯誤訊息
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
作者: a87075172    時間: 2015-10-30 12:15

作者: 超新手    時間: 2015-10-30 12:18
本帖最後由 超新手 於 2015-10-30 12:33 編輯

感覺好像沒有燒錄成功
剛才才看到圖
看了一下...好像沒問題...
可能是你的藍芽和下載程式的 rs232 共用
可以先拔掉藍芽, 再下載程式看看

下載成功再裝回去


作者: a87075172    時間: 2015-10-30 16:57
感謝 現在燒入ok但是手機無法連結藍芽
是不是哪個步驟做錯了
作者: 超新手    時間: 2015-10-30 17:04
本帖最後由 超新手 於 2015-10-30 17:07 編輯

是 HC-0X 嗎?
曾經有連線成功過嗎?
有輸入密碼, 配對成功嗎?
作者: a87075172    時間: 2015-10-30 17:07
本帖最後由 a87075172 於 2015-10-30 17:11 編輯

回復 5# 超新手

沒有連線過
有輸入1234可是就是沒有反應
HC-06的藍芽
作者: 超新手    時間: 2015-10-30 17:43
手機配對成功後
只是會變成"可用的裝置", 應該不會有其他反應
所以是你的 APP 找不到 HC-06 嗎?
你有使用你的 APP, 找到 HC06, 然然連線嗎?
作者: a87075172    時間: 2015-10-30 20:10
回復 7# 超新手
找到裝置連不到,打了密碼沒反應,就是連線沒法成功
作者: a87075172    時間: 2015-10-30 23:30
回復 7# 超新手

Ok了
作者: 我不是小妹    時間: 2015-11-10 19:27
想請問一下
APP是用? Appinventor做的嗎?
遙控的




歡迎光臨 Robofun 機器人論壇 (https://www.robofun.net/forum/) Powered by Discuz! X3.2