I am trying to modify Arduino's servo "sweep" sketch, however I can't seem to get it to compile and upload to my Arduino Uno. Here's the original sweep code:
/* Sweep
by BARRAGAN http://barraganstudio.com
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
http://www.arduino.cc/en/Tutorial/Sweep
*/
#include <Servo.h>
Servo myservo;
int pos = 0;
void setup() {
myservo.attach(9);
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) {
// in steps of 1 degree
myservo.write(pos);
delay(15);
}
for (pos = 180; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(15);
}
}
And then I keep getting the same error message,
Using board 'uno' from platform in folder: /Users/username/Library/Arduino15/packages/arduino/hardware/avr/1.8.3
Using core 'arduino' from platform in folder: /Users/username/Library/Arduino15/packages/arduino/hardware/avr/1.8.3
Detecting libraries used...
/Users/username/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/username/Library/Arduino15/packages/arduino/hardware/avr/1.8.3/cores/arduino -I/Users/username/Library/Arduino15/packages/arduino/hardware/avr/1.8.3/variants/standard /var/folders/92/my6snt694x91v79jrtn8d7wr0000gn/T/arduino-sketch-9F16DA3B3D42C642BD00EB41C0D1EA72/sketch/sketch_apr27a.ino.cpp -o /dev/null
Alternatives for Servo.h: []
ResolveLibrary(Servo.h)
-> candidates: []
Compilation error: Error: 2 UNKNOWN: exit status 1
I'm not sure how to locate where the error stems from within the code, would anyone be able to help me understand where to find such error and/or identify other reasons as to why the sketch won't compile or upload to the Arduino Uno?