Hello, so I am new to arduino, and after a few weeks of coding examples and excercises, i wanted to make a flying wing and in this sketch I was just starting with the alevons values (i know the servo value pot 2 is bad because it can't be -180 for a servo, the range is 0 to 180, not -180 to 180).
*notice there isn't any servo.write.
#include <Servo.h>
int pot = (A4); //potentiometer for controlling direction (elevons)
Servo ServoD; //right servo
Servo ServoL; //left servo
void setup() {
ServoD.attach(2);
ServoL.attach(3);
Serial.begin(9600);
}
void loop() {
float pot1;
pot1 = analogRead (pot);
pot1 = map(pot1, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
float pot2; //opposite value of the other servo (pot1)
pot2 =(pot1) - 180;
Serial.print (pot1);
Serial.print (" , ");
Serial.println (pot2);
delay (250);
}
I was using this arduino nano (atmega328p old bootloader) normally but then I uploaded this code it took way more than usual to upload so i opened the serial monitor and this it gives me one of two errors.
Com port 8 ocuppied *this line of the error is from my memory
An error occurred while uploading the sketch
Invalid library found in C:\Users\fabri\Documents\Arduino\libraries\Arduino: no headers files (.h) found in C:\Users\fabri\Documents\Arduino\libraries\Arduino
Invalid library found in C:\Users\fabri\Documents\Arduino\libraries\Arduino: no headers files (.h) found in C:\Users\fabri\Documents\Arduino\libraries\Arduino
or
An error occurred while uploading the sketch
Invalid library found in C:\Users\fabri\Documents\Arduino\libraries\Arduino: no headers files (.h) found in C:\Users\fabri\Documents\Arduino\libraries\Arduino
Invalid library found in C:\Users\fabri\Documents\Arduino\libraries\Arduino: no headers files (.h) found in C:\Users\fabri\Documents\Arduino\libraries\Arduino
Invalid library found in C:\Users\fabri\Documents\Arduino\libraries\Arduino: no headers files (.h) found in C:\Users\fabri\Documents\Arduino\libraries\Arduino
An error occurred while uploading the sketch
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x7a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x7a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x7a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x7a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x7a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x7a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x7a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x7a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x7a
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x7a
Invalid library found in C:\Users\fabri\Documents\Arduino\libraries\Arduino: no headers files (.h) found in C:\Users\fabri\Documents\Arduino\libraries\Arduino
Invalid library found in C:\Users\fabri\Documents\Arduino\libraries\Arduino: no headers files (.h) found in C:\Users\fabri\Documents\Arduino\libraries\Arduino
So I tried the arduino examples that don't have any library like the basic/fade and it was stuck uploading untill two or so minutes later i get the errror
Sketch uses 1144 bytes (3%) of program storage space. Maximum is 30720 bytes.
Global variables use 13 bytes (0%) of dynamic memory, leaving 2035 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xb5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xb5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xb5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xb5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xb5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xb5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xb5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xb5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xb5
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xb5
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
Invalid library found in C:\Users\fabri\Documents\Arduino\libraries\Arduino: no headers files (.h) found in C:\Users\fabri\Documents\Arduino\libraries\Arduino
Invalid library found in C:\Users\fabri\Documents\Arduino\libraries\Arduino: no headers files (.h) found in C:\Users\fabri\Documents\Arduino\libraries\Arduino
*there aren't any libraries in the fade example
I can still upload to other identical arduino nano so its only the board i tryed updating that code that has the issue.
after a few hours of research I had noticed that pin 2 is not a pwm pin but i haven't found anyone that made the same mistake nor anyone who couldn't upload again after servo.attach.
I wanted to know if i fried my nano or if there is any way to bring it back to life.
Thanks for taking your time to read this noob mistake.