欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
自己寫的一個人藍牙Arduino小車程序源碼
[打印本頁]
作者:
songyuan
時間:
2018-7-15 16:32
標題:
自己寫的一個人藍牙Arduino小車程序源碼
自己寫的一個人藍牙Arduino小車,附件有藍牙串口助手
0.png
(3.96 KB, 下載次數: 68)
下載附件
2018-7-15 19:04 上傳
Arduino源程序如下:
//因為數字端口2和13未被占用,所以我們就要2和13端口來接超聲波模塊。
#include <AFMotor.h>
//int inputPin=13; // 定義超聲波Trig
//int outputPin=2; // 定義超聲波Echo
AF_DCMotor motor1(1, MOTOR12_64KHZ);// 創建電機#1號,速度是64KHz pwm
AF_DCMotor motor2(2, MOTOR12_64KHZ);// 創建電機#2號,速度是64KHz pwm
AF_DCMotor motor3(3, MOTOR12_64KHZ);// 創建電機#2號,速度是64KHz pwm
AF_DCMotor motor4(4, MOTOR12_64KHZ);// 創建電機#2號,速度是64KHz pwm
void setup()
{
Serial.begin(9600);
//pinMode(inputPin, INPUT);
// pinMode(outputPin, OUTPUT);
motor1.setSpeed(150);// 設置電機速度,從200/255之間任意(我這倆電機速度不一樣,所以我就這樣設置)
motor2.setSpeed(150);// 設置電機速度,從200/255之間任意(大家可以按照自己的電機轉速來調節一樣的速度就可以了)
motor3.setSpeed(150);
motor4.setSpeed(150);
Serial.println("Motor test!");
}
void loop()
{
//digitalWrite(outputPin, LOW); // 使發出發出超聲波信號接口低電平2μs
//delayMicroseconds(2);
// digitalWrite(outputPin, HIGH); // 使發出發出超聲波信號接口高電平10μs,這里是至少10μs
// delayMicroseconds(10);
// digitalWrite(outputPin, LOW); // 保持發出超聲波信號接口低電平
// int distance = pulseIn(inputPin, HIGH); // 讀出脈沖時間
//distance= distance/58; // 將脈沖時間轉化為距離(單位:厘米)
//Serial.println(distance); //輸出距離值
delay(3000);
//if (distance < 120 ) //大于50厘米就前進
//小車前進
{
//Serial.print("tick");
motor1.run(FORWARD);// 電機前進
motor2.run(FORWARD);// 電機前進
motor3.run(FORWARD);// 電機前進
motor4.run(FORWARD);// 電機前進
}
delay(3000);
//if (distance > 50) //小雨50厘米就后退
//小車后退
{
//Serial.print("tock");
motor1.run(BACKWARD);// 電機后退
motor2.run(BACKWARD);// 電機后退
motor3.run(BACKWARD);// 電機后退
motor4.run(BACKWARD);// 電機后退
}
//if (distance == 50) //等于50厘米就停止
//小車停止
delay(3000);
{
//Serial.print("tack");
motor1.run(RELEASE);// 電機停止
motor2.run(RELEASE);// 電機停止
motor3.run(RELEASE);// 電機停止
motor4.run(RELEASE);// 電機停止
}
//小車左轉
delay(3000);
{
motor1.run(FORWARD);// 電機前進
motor2.run(FORWARD);// 電機前進
motor3.run(BACKWARD);// 電機后退
motor4.run(BACKWARD);// 電機后退
}
//小車右轉
delay(3000);
{
motor3.run(FORWARD);// 電機前進
motor4.run(FORWARD);// 電機前進
motor1.run(BACKWARD);// 電機后退
motor2.run(BACKWARD);// 電機后退
}
}
復制代碼
所有資料51hei提供下載:
lanyachuankou_41.zip
(1.69 MB, 下載次數: 18)
2018-7-15 16:31 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
1.zip
(1.38 KB, 下載次數: 16)
2018-7-15 16:27 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
作者:
迷一樣謙謙公子
時間:
2019-4-2 21:03
請問可以出一個app的開發教程么?或者請指教一下
作者:
大貓8888
時間:
2019-6-28 16:12
arduino --board arduino:avr:yun --save-prefs
arduino -v --board arduino:avr:yun --pref build.path=mixlyBuild --verify "F:\Mixly0998/testArduino/testArduino.ino"
F:\Mixly0998\.\arduino-1.8.5\arduino-builder -dump-prefs -logger=machine -hardware F:\Mixly0998\.\arduino-1.8.5\hardware -tools F:\Mixly0998\.\arduino-1.8.5\tools-builder -tools F:\Mixly0998\.\arduino-1.8.5\hardware\tools\avr -built-in-libraries F:\Mixly0998\.\arduino-1.8.5\libraries -libraries C:\Users\Administrator\Documents\Arduino\libraries -fqbn=arduino:avr:yun -ide-version=10806 -build-path F:\Mixly0998\mixlyBuild -warnings=null -prefs=build.path=mixlyBuild -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=F:\Mixly0998\.\arduino-1.8.5\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=F:\Mixly0998\.\arduino-1.8.5\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=F:\Mixly0998\.\arduino-1.8.5\hardware\tools\avr -verbose F:\Mixly0998\testArduino\testArduino.ino
F:\Mixly0998\.\arduino-1.8.5\arduino-builder -compile -logger=machine -hardware F:\Mixly0998\.\arduino-1.8.5\hardware -tools F:\Mixly0998\.\arduino-1.8.5\tools-builder -tools F:\Mixly0998\.\arduino-1.8.5\hardware\tools\avr -built-in-libraries F:\Mixly0998\.\arduino-1.8.5\libraries -libraries C:\Users\Administrator\Documents\Arduino\libraries -fqbn=arduino:avr:yun -ide-version=10806 -build-path F:\Mixly0998\mixlyBuild -warnings=null -prefs=build.path=mixlyBuild -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=F:\Mixly0998\.\arduino-1.8.5\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=F:\Mixly0998\.\arduino-1.8.5\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=F:\Mixly0998\.\arduino-1.8.5\hardware\tools\avr -verbose F:\Mixly0998\testArduino\testArduino.ino
Using board 'yun' from platform in folder: F:\Mixly0998\arduino-1.8.5\hardware\arduino\avr
Using core 'arduino' from platform in folder: F:\Mixly0998\arduino-1.8.5\hardware\arduino\avr
構建選項已變更,全部重新構建
Detecting libraries used...
"F:\Mixly0998\.\arduino-1.8.5\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10806 -DARDUINO_AVR_YUN -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8041 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Yun"' "-IF:\Mixly0998\arduino-1.8.5\hardware\arduino\avr\cores\arduino" "-IF:\Mixly0998\arduino-1.8.5\hardware\arduino\avr\variants\yun" "F:\Mixly0998\mixlyBuild\sketch\testArduino.ino.cpp" -o "nul"
"F:\Mixly0998\.\arduino-1.8.5\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10806 -DARDUINO_AVR_YUN -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8041 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Yun"' "-IF:\Mixly0998\arduino-1.8.5\hardware\arduino\avr\cores\arduino" "-IF:\Mixly0998\arduino-1.8.5\hardware\arduino\avr\variants\yun" "F:\Mixly0998\mixlyBuild\sketch\testArduino.ino.cpp" -o "F:\Mixly0998\mixlyBuild\preproc\ctags_target_for_gcc_minus_e.cpp"
F:\Mixly0998\testArduino\testArduino.ino:2:21: fatal error: AFMotor.h: No such file or directory
#include <AFMotor.h>
^
compilation terminated.
exit status 1
編譯失敗!
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1