打算自己做蓝牙小车
蓝牙模块+ESP8266
试了几种开发板编译,都不成功
编译程序时出现以下报错;
C:\Users\Martin\AppData\Local\Temp\arduino_build_566136\libraries\MagicRC-master\MagicRC.cpp.o (symbol from plugin): In function `MagicRC::MagicRC(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char)':
(.text+0x0): multiple definition of `MagicRC::run()'
C:\Users\Martin\AppData\Local\Temp\arduino_build_566136\sketch\car__contrl.ino.cpp.o (symbol from plugin).text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
使用 1.0 版本的库 SoftwareSerial 在文件夹: D:\arduino-1.8.10\hardware\arduino\avr\libraries\SoftwareSerial
使用库 MagicRC-master 在文件夹: C:\Users\Martin\Documents\Arduino\libraries\MagicRC-master (legacy)
exit status 1
为开发板 Arduino Uno WiFi 编译时出错。
以下是程序;各位大神看看有啥问题,
#include <SoftwareSerial.h>
#include <MagicRC.h>
MagicRC myRC(8, 9, 3, 4, 5, 6); // Bluetooth TX, RX
void setup() {
myRC.begin(9600); // Bluetooth baudrate
}
void loop() {
myRC.run();
}
void MagicRC::run() {
if (btSerial->available()) {
char c = btSerial->read();
switch (c) {
case 'S':
stop();
break;
case 'F':
forward();
break;
case 'B':
backward();
break;
case 'L':
turnLeft();
break;
case 'R':
turnRight();
break;
case '0':
setSpeed(0);
break;
case '5':
setSpeed(125);
break;
case 'q':
setSpeed(255);
break;
}
}
}
|