精品国产人成在线_亚洲高清无码在线观看_国产在线视频国产永久2021_国产AV综合第一页一个的一区免费影院黑人_最近中文字幕MV高清在线视频

電子發燒友App

硬聲App

0
  • 聊天消息
  • 系統消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術視頻
  • 寫文章/發帖/加入社區
會員中心
創作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示
電子發燒友網>電子資料下載>電子資料>Android應用程序控制的機器人車

Android應用程序控制的機器人車

2022-11-08 | zip | 0.82 MB | 次下載 | 免費

資料介紹

描述

大家好!這是我的下一個項目,智能手機控制的 Arduino 4WD 機器人汽車或藍牙 Arduino 機器人。它可以前后左右移動,改變速度,打開/關閉前后燈,也可以喇叭。

這是一個非常簡單的設計機器人,您可以輕松構建它。

第 1 步:要求

所需零件:

  • Arduino Uno R3 板
  • 帶直流電機和車輪 x4 的底盤 4WD
  • 藍牙模塊HC-06
  • 蜂鳴器

第二步:組裝四驅機器人智能汽車底盤

 

第 3 步:接線圖

?
poYBAGNonzWAGiapAAmjdYWTAEg694.jpg
按照上面的接線圖進行連接。
?

第 4 步:上傳機器人代碼

#define light_FR  14    //LED Front Right   pin A0 for Arduino Uno#define light_FL  15    //LED Front Left    pin A1 for Arduino Uno #define light_BR  16    //LED Back Right    pin A2 for Arduino Uno #define light_BL  17    //LED Back Left     pin A3 for Arduino Uno #define horn_Buzz 18    //Horn Buzzer       pin A4 for Arduino Uno#define ENA_m1 5        // Enable/speed motor Front Right  #define ENB_m1 6        // Enable/speed motor Back Right #define ENA_m2 10       // Enable/speed motor Front Left #define ENB_m2 11       // Enable/speed motor Back Left#define IN_11  2      // L298N #1 in 1 motor Front Right #define IN_12  3      // L298N #1 in 2 motor Front Right #define IN_13  4      // L298N #1 in 3 motor Back Right #define IN_14  7      // L298N #1 in 4 motor Back Right#define IN_21  8      // L298N #2 in 1 motor Front Left #define IN_22  9      // L298N #2 in 2 motor Front Left #define IN_23  12     // L298N #2 in 3 motor Back Left #define IN_24  13     // L298N #2 in 4 motor Back Leftint command;          //Int to store app command state. int speedCar = 100;   // 50 - 255. int speed_Coeff = 4; boolean lightFront = false; boolean lightBack = false; boolean horn = false;void setup() {          pinMode(light_FR, OUTPUT);     pinMode(light_FL, OUTPUT);     pinMode(light_BR, OUTPUT);     pinMode(light_BL, OUTPUT);     pinMode(horn_Buzz, OUTPUT);         pinMode(ENA_m1, OUTPUT);    pinMode(ENB_m1, OUTPUT);    pinMode(ENA_m2, OUTPUT);    pinMode(ENB_m2, OUTPUT);        pinMode(IN_11, OUTPUT);     pinMode(IN_12, OUTPUT);     pinMode(IN_13, OUTPUT);     pinMode(IN_14, OUTPUT);          pinMode(IN_21, OUTPUT);     pinMode(IN_22, OUTPUT);     pinMode(IN_23, OUTPUT);     pinMode(IN_24, OUTPUT);Serial.begin(9600); } void goAhead(){ digitalWrite(IN_11, HIGH);       digitalWrite(IN_12, LOW);      analogWrite(ENA_m1, speedCar);digitalWrite(IN_13, LOW);       digitalWrite(IN_14, HIGH);      analogWrite(ENB_m1, speedCar);digitalWrite(IN_21, LOW);       digitalWrite(IN_22, HIGH);      analogWrite(ENA_m2, speedCar);digitalWrite(IN_23, HIGH);       digitalWrite(IN_24, LOW);      analogWrite(ENB_m2, speedCar);}void goBack(){ digitalWrite(IN_11, LOW);       digitalWrite(IN_12, HIGH);      analogWrite(ENA_m1, speedCar);digitalWrite(IN_13, HIGH);       digitalWrite(IN_14, LOW);      analogWrite(ENB_m1, speedCar);digitalWrite(IN_21, HIGH);       digitalWrite(IN_22, LOW);      analogWrite(ENA_m2, speedCar);digitalWrite(IN_23, LOW);       digitalWrite(IN_24, HIGH);      analogWrite(ENB_m2, speedCar);}void goRight(){ digitalWrite(IN_11, LOW);       digitalWrite(IN_12, HIGH);      analogWrite(ENA_m1, speedCar);digitalWrite(IN_13, HIGH);       digitalWrite(IN_14, LOW);      analogWrite(ENB_m1, speedCar);digitalWrite(IN_21, LOW);       digitalWrite(IN_22, HIGH);      analogWrite(ENA_m2, speedCar);digitalWrite(IN_23, HIGH);       digitalWrite(IN_24, LOW);      analogWrite(ENB_m2, speedCar);}void goLeft(){digitalWrite(IN_11, HIGH);       digitalWrite(IN_12, LOW);      analogWrite(ENA_m1, speedCar);digitalWrite(IN_13, LOW);       digitalWrite(IN_14, HIGH);      analogWrite(ENB_m1, speedCar);digitalWrite(IN_21, HIGH);       digitalWrite(IN_22, LOW);      analogWrite(ENA_m2, speedCar);digitalWrite(IN_23, LOW);       digitalWrite(IN_24, HIGH);      analogWrite(ENB_m2, speedCar);}void goAheadRight(){              digitalWrite(IN_11, HIGH);       digitalWrite(IN_12, LOW);       analogWrite(ENA_m1, speedCar/speed_Coeff);digitalWrite(IN_13, LOW);       digitalWrite(IN_14, HIGH);       analogWrite(ENB_m1, speedCar/speed_Coeff);digitalWrite(IN_21, LOW);       digitalWrite(IN_22, HIGH);       analogWrite(ENA_m2, speedCar);digitalWrite(IN_23, HIGH);       digitalWrite(IN_24, LOW);       analogWrite(ENB_m2, speedCar);     }void goAheadLeft(){              digitalWrite(IN_11, HIGH);       digitalWrite(IN_12, LOW);       analogWrite(ENA_m1, speedCar);digitalWrite(IN_13, LOW);       digitalWrite(IN_14, HIGH);       analogWrite(ENB_m1, speedCar);digitalWrite(IN_21, LOW);       digitalWrite(IN_22, HIGH);       analogWrite(ENA_m2, speedCar/speed_Coeff);digitalWrite(IN_23, HIGH);       digitalWrite(IN_24, LOW);       analogWrite(ENB_m2, speedCar/speed_Coeff);     }void goBackRight(){ digitalWrite(IN_11, LOW);       digitalWrite(IN_12, HIGH);       analogWrite(ENA_m1, speedCar/speed_Coeff);digitalWrite(IN_13, HIGH);       digitalWrite(IN_14, LOW);       analogWrite(ENB_m1, speedCar/speed_Coeff);digitalWrite(IN_21, HIGH);       digitalWrite(IN_22, LOW);       analogWrite(ENA_m2, speedCar);digitalWrite(IN_23, LOW);       digitalWrite(IN_24, HIGH);       analogWrite(ENB_m2, speedCar);}void goBackLeft(){ digitalWrite(IN_11, LOW);       digitalWrite(IN_12, HIGH);       analogWrite(ENA_m1, speedCar);digitalWrite(IN_13, HIGH);       digitalWrite(IN_14, LOW);       analogWrite(ENB_m1, speedCar);digitalWrite(IN_21, HIGH);       digitalWrite(IN_22, LOW);       analogWrite(ENA_m2, speedCar/speed_Coeff);digitalWrite(IN_23, LOW);       digitalWrite(IN_24, HIGH);       analogWrite(ENB_m2, speedCar/speed_Coeff);}void stopRobot(){ digitalWrite(IN_11, LOW);       digitalWrite(IN_12, LOW);      analogWrite(ENA_m1, speedCar);digitalWrite(IN_13, LOW);       digitalWrite(IN_14, LOW);      analogWrite(ENB_m1, speedCar);digitalWrite(IN_21, LOW);       digitalWrite(IN_22, LOW);      analogWrite(ENA_m2, speedCar);digitalWrite(IN_23, LOW);       digitalWrite(IN_24, LOW);      analogWrite(ENB_m2, speedCar);      }    void loop(){    if (Serial.available() > 0) {  command = Serial.read();  stopRobot();    //Initialize with motors stopped.if (lightFront) {digitalWrite(light_FR, HIGH); digitalWrite(light_FL, HIGH);} if (!lightFront) {digitalWrite(light_FR, LOW); digitalWrite(light_FL, LOW);} if (lightBack) {digitalWrite(light_BR, HIGH); digitalWrite(light_BL, HIGH);} if (!lightBack) {digitalWrite(light_BR, LOW); digitalWrite(light_BL, LOW);} if (horn) {digitalWrite(horn_Buzz, HIGH);} if (!horn) {digitalWrite(horn_Buzz, LOW);}switch (command) { case 'F':goAhead();break; case 'B':goBack();break; case 'L':goLeft();break; case 'R':goRight();break; case 'I':goAheadRight();break; case 'G':goAheadLeft();break; case 'J':goBackRight();break; case 'H':goBackLeft();break; case '0':speedCar = 100;break; case '1':speedCar = 115;break; case '2':speedCar = 130;break; case '3':speedCar = 145;break; case '4':speedCar = 160;break; case '5':speedCar = 175;break; case '6':speedCar = 190;break; case '7':speedCar = 205;break; case '8':speedCar = 220;break; case '9':speedCar = 235;break; case 'q':speedCar = 255;break; case 'W':lightFront = true;break; case 'w':lightFront = false;break; case 'U':lightBack = true;break; case 'u':lightBack = false;break; case 'V':horn = true;break; case 'v':horn = false;break;} } }

第 5 步:注釋

在上傳代碼之前,您必須斷開藍牙模塊與 Arduino Uno 板(引腳 0、1)的連接。

第 6 步:下載 Android 應用程序

第 7 步:連接藍牙模塊

要將您的智能手機連接到 Arduino 藍牙模塊 HC-06,我們必須輸入 PIN CODE 1234 或 0000。

代碼::

第 8 步:完成

一旦您正確完成所有步驟,機器人就可以開始使用了!

謝謝你們!


下載該資料的人也在下載 下載該資料的人還在閱讀
更多 >

評論

查看更多

下載排行

本周

  1. 1山景DSP芯片AP8248A2數據手冊
  2. 1.06 MB  |  532次下載  |  免費
  3. 2RK3399完整板原理圖(支持平板,盒子VR)
  4. 3.28 MB  |  339次下載  |  免費
  5. 3TC358743XBG評估板參考手冊
  6. 1.36 MB  |  330次下載  |  免費
  7. 4DFM軟件使用教程
  8. 0.84 MB  |  295次下載  |  免費
  9. 5元宇宙深度解析—未來的未來-風口還是泡沫
  10. 6.40 MB  |  227次下載  |  免費
  11. 6迪文DGUS開發指南
  12. 31.67 MB  |  194次下載  |  免費
  13. 7元宇宙底層硬件系列報告
  14. 13.42 MB  |  182次下載  |  免費
  15. 8FP5207XR-G1中文應用手冊
  16. 1.09 MB  |  178次下載  |  免費

本月

  1. 1OrCAD10.5下載OrCAD10.5中文版軟件
  2. 0.00 MB  |  234315次下載  |  免費
  3. 2555集成電路應用800例(新編版)
  4. 0.00 MB  |  33566次下載  |  免費
  5. 3接口電路圖大全
  6. 未知  |  30323次下載  |  免費
  7. 4開關電源設計實例指南
  8. 未知  |  21549次下載  |  免費
  9. 5電氣工程師手冊免費下載(新編第二版pdf電子書)
  10. 0.00 MB  |  15349次下載  |  免費
  11. 6數字電路基礎pdf(下載)
  12. 未知  |  13750次下載  |  免費
  13. 7電子制作實例集錦 下載
  14. 未知  |  8113次下載  |  免費
  15. 8《LED驅動電路設計》 溫德爾著
  16. 0.00 MB  |  6656次下載  |  免費

總榜

  1. 1matlab軟件下載入口
  2. 未知  |  935054次下載  |  免費
  3. 2protel99se軟件下載(可英文版轉中文版)
  4. 78.1 MB  |  537798次下載  |  免費
  5. 3MATLAB 7.1 下載 (含軟件介紹)
  6. 未知  |  420027次下載  |  免費
  7. 4OrCAD10.5下載OrCAD10.5中文版軟件
  8. 0.00 MB  |  234315次下載  |  免費
  9. 5Altium DXP2002下載入口
  10. 未知  |  233046次下載  |  免費
  11. 6電路仿真軟件multisim 10.0免費下載
  12. 340992  |  191187次下載  |  免費
  13. 7十天學會AVR單片機與C語言視頻教程 下載
  14. 158M  |  183279次下載  |  免費
  15. 8proe5.0野火版下載(中文版免費下載)
  16. 未知  |  138040次下載  |  免費