我想用arduino mega和10k pot来控制我的机器人手臂。但我得到了错误。我的代码:
#include<Servo.h>
Servo armServo; //we defined a object named armServo
int positionOfArmServo=15;
int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
void setup()
{
Serial.begin(9600);
armServo.attach(9); //attaches the servo on pin 9 to a servo object
armServo.write(140);
}
void loop()
{
sensorValue = analogRead(sensorPin);
sensorValue=map(sensorValue,0,1023,0,170);
armServo.write(sensorValue);
delay(10);
}
我的错误是:
c:/程序文件 (86)/的Arduino /硬件/工具/ AVR / bin中/../ lib中/ GCC / AVR / 4.3.2 / .. /../../../avr/lib/av R6 / crtm2560的.o: 在函数__vector_default&#39; :(。vector + 0xd0):重定位被截断 适合:R_AVR_13_PCREL反对符号__vector_52&#39;定义于 core.a中的.text .__ vector_52部分(HardwareSerial.cpp.o)
请帮助我!