#include <Servo.h>
int servoPin = 9;
Servo servo;
int ReadL;
int ReadR;
int maxRead;
int difference;
void setup() {
// put your setup code here, to run once:
pinMode(A0, INPUT);
pinMode(A2, INPUT);
Serial.begin(9600);
servo.attach(servoPin);
}
void loop() {
// put your main code here, to run repeatedly:
analogRead(A0);
analogRead(A2);
ReadL = (analogRead(A2));
ReadR = (analogRead(A0));
Serial.print(ReadL);
Serial.print(" ");
Serial.println(ReadR);
difference = abs(ReadR - ReadL);
if (difference > 50) {
maxRead = max(ReadL, ReadR);
if (maxRead == ReadL) {
servo.write(180);
}
if (maxRead == ReadR) {
servo.write(0);
}
}
if (difference <= 50) {
servo.write(90);
}
}
Arduino: 1.8.13 (Mac OS X), Board: "Arduino Nano, ATmega328P"
fork/exec /Users/Nate/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++: no such file or directory
Error compiling for board Arduino Nano.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Any insight on why this error comes up would be greatly appreciated. Thanks
Hi @nate_engineers118. This error indicates something has gone wrong with an Arduino boards platform installed via Boards Manager. The solution is to remove the installed packages. Be aware this will remove any boards you have installed via Boards Manager (but they can easily be installed again):
Select File > Preferences from the Arduino IDE menus.
Click the link on the line following "More preferences can be edited directly in the file".
This will open the Arduino15 (or similar name depending on OS) folder.
Delete all files and folders under the Arduino15 folder except for preferences.txt.
Please be very careful when deleting things from your computer. When in doubt, back up!
Restart the Arduino IDE
Now try compiling or uploading to your board again. Hopefully the error will no longer occur.
If you had other boards platforms installed, you can now reinstall them as usual via the Arduino Boards Manager (Tools > Board > Boards Manager).
Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
Repeated cross-posting can result in a suspension from the forum.
In the future, please take some time to pick the forum category that best suits the subject of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide you will find at the top of every forum category. It contains a lot of other useful information. Please read it.