I have been working on an electric longboard and have run into some problem while uploading this sketch to the attiny45.
#include <SoftwareServo.h>
int potentiometer=A1;
int button1=3;
int button2=4;
int potval;
int curval;
SoftwareServo ESC;
void setup() {
pinMode(potentiometer, INPUT);
pinMode(button1, INPUT);
pinMode(button2, INPUT);
ESC.attach(1);
curval=0;
ESC.setMinimumPulse(800);
ESC.setMaximumPulse(2000);
}
void loop() {
while (digitalRead(button1)==HIGH){
potval=analogRead(potentiometer);
potval=map(potval,0,1023,0,180);
while(curval<potval){
potval=analogRead(potentiometer);
potval=map(potval,0,1023,0,180);
curval=curval+1;
ESC.write(curval);
SoftwareServo::refresh();
delay(50);
while(digitalRead(button2)==HIGH){
ESC.write(curval);
SoftwareServo::refresh();}}
while(curval>potval){
potval=analogRead(potentiometer);
potval=map(potval,0,1023,0,180);
curval=curval-1;
ESC.write(curval);
SoftwareServo::refresh();
delay(50);
while(digitalRead(button2)==HIGH){
ESC.write(curval);
SoftwareServo::refresh();}}
ESC.write(curval);
SoftwareServo::refresh();}
potval=0;
while(curval>potval){
curval=curval-1;
ESC.write(curval);
SoftwareServo::refresh();
delay(50);}
ESC.write(curval);
SoftwareServo::refresh();}
The error code is:
Arduino: 1.8.5 (Windows 10), Board: "ATtiny25/45/85, ATtiny45, Internal 8 MHz"
D:\Arduino\arduino-builder -dump-prefs -logger=machine -hardware D:\Arduino\hardware -hardware C:\Users\User\AppData\Local\Arduino15\packages -tools D:\Arduino\tools-builder -tools D:\Arduino\hardware\tools\avr -tools C:\Users\User\AppData\Local\Arduino15\packages -built-in-libraries D:\Arduino\libraries -libraries C:\Users\User\Documents\Arduino\libraries -fqbn=attiny:avr:ATtinyX5:cpu=attiny45,clock=internal8 -vid-pid=0X2A03_0X0043 -ide-version=10805 -build-path C:\Users\User\AppData\Local\Temp\arduino_build_148958 -warnings=none -build-cache C:\Users\User\AppData\Local\Temp\arduino_cache_601655 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=D:\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=D:\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=D:\Arduino\hardware\tools\avr -verbose C:\Users\User\Desktop\AttinySketch\AttinySketch.ino
D:\Arduino\arduino-builder -compile -logger=machine -hardware D:\Arduino\hardware -hardware C:\Users\User\AppData\Local\Arduino15\packages -tools D:\Arduino\tools-builder -tools D:\Arduino\hardware\tools\avr -tools C:\Users\User\AppData\Local\Arduino15\packages -built-in-libraries D:\Arduino\libraries -libraries C:\Users\User\Documents\Arduino\libraries -fqbn=attiny:avr:ATtinyX5:cpu=attiny45,clock=internal8 -vid-pid=0X2A03_0X0043 -ide-version=10805 -build-path C:\Users\User\AppData\Local\Temp\arduino_build_148958 -warnings=none -build-cache C:\Users\User\AppData\Local\Temp\arduino_cache_601655 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=D:\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=D:\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=D:\Arduino\hardware\tools\avr -verbose C:\Users\User\Desktop\AttinySketch\AttinySketch.ino
Using board 'ATtinyX5' from platform in folder: C:\Users\User\AppData\Local\Arduino15\packages\attiny\hardware\avr\1.0.2
Using core 'arduino' from platform in folder: D:\Arduino\hardware\arduino\avr
Detecting libraries used...
"D:\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=attiny45 -DF_CPU=8000000L -DARDUINO=10805 -DARDUINO_attiny -DARDUINO_ARCH_AVR "-ID:\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Users\User\AppData\Local\Arduino15\packages\attiny\hardware\avr\1.0.2\variants\tiny8" "C:\Users\User\AppData\Local\Temp\arduino_build_148958\sketch\AttinySketch.ino.cpp" -o "nul"
"D:\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=attiny45 -DF_CPU=8000000L -DARDUINO=10805 -DARDUINO_attiny -DARDUINO_ARCH_AVR "-ID:\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Users\User\AppData\Local\Arduino15\packages\attiny\hardware\avr\1.0.2\variants\tiny8" "C:\Users\User\AppData\Local\Temp\arduino_build_148958\sketch\AttinySketch.ino.cpp" -o "C:\Users\User\AppData\Local\Temp\arduino_build_148958\preproc\ctags_target_for_gcc_minus_e.cpp"
C:\Users\User\Desktop\AttinySketch\AttinySketch.ino:1:28: fatal error: SoftwareServo.h: No such file or directory
#include <SoftwareServo.h>
^
compilation terminated.
exit status 1
Error compiling for board ATtiny25/45/85.
Maybe someone could help me with my project because I don't know where the problem is ![]()
error code.txt (3.39 KB)