|
本帖最后由 hetzenauer 于 2013-3-26 15:47 编辑
今天收到apc220无线传输模块,但是设置好了以后使用下载的RF-ANET软件却一直跳出错误提示,说没有发现串行端口,更新了驱动程序以后还是老样子,去硬件管理器里面看了串口是正常的,不知道怎么才能解决。
另外一个问题是今天做履带底盘前进后退程序的时候,我根据《arduino开发实战指南》里面的程序烧入之后,发现只有用USB线连接电脑的时候芯片才正常工作,如果不连接电脑只连接电源的话就只是间断前进,不知何故,希望各位高人不吝赐教。多谢
编写MotorCar库的时候又出现问题,我在头文件MotorCar.h里面已经定义了私有函数_speedLeftPin,_speedRightPin,_dirLeftPin,_dirRightPin以及公有函数MotorCar(int,int,int,int),forward,back,turnLeft,turnRight,turnLeftOrigin,turnRightOrigin,stop,但是在试运行的时候,编译时提示cpp里面每个子函数都有问题
#include <MotorCar.h>
MotorCar::MotorCar(int _slpin,int _dlpin,int _srpin,int _drpin)
{
_speedLeftPin=_slpin;
_speedRightPin=_srpin;
_dirLeftPin=_dlpin;
_dirRightPin=_drpin;
pinMode(_speedLeftPin,OUTPUT);
pinMode(_speedRightPin,OUTPUT);
pinMode(_dirLeftPin,OUTPUT);
pinMode(_dirRightPin,OUTPUT);
}
void MotorCar::forward(int _speed)
{
digitalWrite(_dirRightPin,HIGH);
digitalWrite(_dirLeftPin,HIGH);
analogWrite(_speedRightPin,_speed);
analogWrite(_speedLeftPin,_speed);
}
void MotorCar::back(int _speed)
{
digitalWrite(_dirRightPin,LOW);
digitalWrite(_dirLeftPin,LOW);
analogWrite(_speedRightPin,_speed);
analogWrite(_speedLeftPin,_speed);
}
void MotorCar::turnLeft(int _speed)
{
digitalWrite(_dirRightPin,HIGH);
analogWrite(_speedRightPin,_speed);
analogWrite(_speedLeftPin,0);
}
void MotorCar::turnRight(int _speed)
{
digitalWrite(_dirLeftPin,HIGH);
analogWrite(_speedLeftPin,_speed);
analogWrite(_speedRightPin,0);
}
void MotorCar::turnRightOrigin(int _speed)
{
digitalWrite(_dirRightPin,LOW);
digitalWrite(_dirLeftPin,HIGH);
analogWrite(_speedRightPin,_speed);
analogWrite(_speedLeftPin,_speed);
}
void MotorCar::turnLeftOrigin(int _speed)
{
digitalWrite(_dirRightPin,HIGH);
digitalWrite(_dirLeftPin,LOW);
analogWrite(_speedRightPin,_speed);
analogWrite(_speedLeftPin,_speed);
}
void MotorCar::stop()
{
analogWrite(_speedRightPin,0);
analogWrite(_speedLeftPin,0);
}
提示是
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp: In constructor 'MotorCar::MotorCar(int, int, int, int)':
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:12: error: 'OUTPUT' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:12: error: 'pinMode' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp: In member function 'void MotorCar::forward(int)':
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:19: error: 'HIGH' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:19: error: 'digitalWrite' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:21: error: 'analogWrite' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp: In member function 'void MotorCar::back(int)':
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:26: error: 'LOW' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:26: error: 'digitalWrite' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:28: error: 'analogWrite' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp: In member function 'void MotorCar::turnLeft(int)':
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:33: error: 'HIGH' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:33: error: 'digitalWrite' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:34: error: 'analogWrite' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp: In member function 'void MotorCar::turnRight(int)':
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:39: error: 'HIGH' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:39: error: 'digitalWrite' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:40: error: 'analogWrite' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp: In member function 'void MotorCar::turnRightOrigin(int)':
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:45: error: 'LOW' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:45: error: 'digitalWrite' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:46: error: 'HIGH' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:47: error: 'analogWrite' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp: In member function 'void MotorCar::turnLeftOrigin(int)':
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:52: error: 'HIGH' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:52: error: 'digitalWrite' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:53: error: 'LOW' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:54: error: 'analogWrite' was not declared in this scope
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp: In member function 'void MotorCar::stop()':
E:\arduino-1.0.3-windows\arduino-1.0.3\libraries\MotorCar\MotorCar.cpp:59: error: 'analogWrite' was not declared in this scope
HIGH,LOW,pinMode之类的我怎么定义啊,这不应该是原本就自带的么 |
|