I just have a simple problem with a project that I am doing that involves moving a servo with an IR remote. Every time I try to upload the code I get "serial port busy". I assume this means I have code already on Arduino that is preventing the other from running but I don't know how to wipe/reset the Arduino.
#include <IRremote.h>
#include <Servo.h>
int IRpin = 11; // pin for the IR sensor
IRrecv irrecv(IRpin);
decode_results results;
Servo myservo;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
if (irrecv.decode(&results))
{
irrecv.resume(); // Receive the next value
}
if (results.value == 33441975) // change according to your IR remote button number
{
myservo.write(0);
delay(15);
}
if (results.value == 33446055) // change according to your IR remote button number
{
myservo.write(30);
delay(15);
}
}
Moderator edit: </mark> <mark>[code]</mark> <mark>
Hey, I was wondering if anyone knows how to deal with a busy serial port. I am trying to upload code but it would seem another code is already running on the Arduino. I keep getting the error message "E18-SerialPort Resource busy". I have tried wiping the Arduino but I keep running into the same problem. Please help thanks.
DrDiettrich:
In case you happened to overwrite the boot loader on the Arduino you have to burn a new boot loader before the board can be reprogrammed by USB.
How would a beginner accomplish overwriting the bootloader? It's not something one can "accidentally" do.
Are you connecting with a terminal emulator like Putty? Unlike the serial monitor, Putty (or whatever terminal emulator) doesn't automatically disconnect when a sketch has to be uploaded.
OK cowboy, start by explaining what operating system you are using, whether you are using the Arduino IDE because that message sounds quite unfamiliar, what else you have connected to the PC and what projects you used on the Arduino before that did work, and what you have done in the interim.