Robofun 機器人論壇

 找回密碼
 申請會員
搜索
熱搜: 活動 交友 discuz
查看: 2665|回復: 9

藍芽自走車無法燒入成功

[複製鏈接]
發表於 2015-10-30 12:10:26 | 顯示全部樓層 |閱讀模式
我要做一個藍芽自走車,以下次我的程式:
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
 樓主| 發表於 2015-10-30 12:15:19 | 顯示全部樓層
未命名.png
發表於 2015-10-30 12:18:19 | 顯示全部樓層
本帖最後由 超新手 於 2015-10-30 12:33 編輯

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

下載成功再裝回去

 樓主| 發表於 2015-10-30 16:57:48 | 顯示全部樓層
感謝 現在燒入ok但是手機無法連結藍芽
是不是哪個步驟做錯了
發表於 2015-10-30 17:04:56 | 顯示全部樓層
本帖最後由 超新手 於 2015-10-30 17:07 編輯

是 HC-0X 嗎?
曾經有連線成功過嗎?
有輸入密碼, 配對成功嗎?
 樓主| 發表於 2015-10-30 17:07:58 | 顯示全部樓層
本帖最後由 a87075172 於 2015-10-30 17:11 編輯

回復 5# 超新手

沒有連線過
有輸入1234可是就是沒有反應
HC-06的藍芽
發表於 2015-10-30 17:43:42 | 顯示全部樓層
手機配對成功後
只是會變成"可用的裝置", 應該不會有其他反應
所以是你的 APP 找不到 HC-06 嗎?
你有使用你的 APP, 找到 HC06, 然然連線嗎?
 樓主| 發表於 2015-10-30 20:10:30 | 顯示全部樓層
回復 7# 超新手
找到裝置連不到,打了密碼沒反應,就是連線沒法成功
 樓主| 發表於 2015-10-30 23:30:49 | 顯示全部樓層
回復 7# 超新手

Ok了
發表於 2015-11-10 19:27:54 | 顯示全部樓層
想請問一下
APP是用? Appinventor做的嗎?
遙控的
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

小黑屋|手機版|Archiver|機器人論壇 from 2005.07

GMT+8, 2024-4-19 05:45 , Processed in 0.245927 second(s), 9 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表