Hello,
I am currently building an electric longboard based off of this tutorial: http://www.instructables.com/id/Make-Your-Own-Electric-Motorized-Longboard/.
The controller uses an ATtiny45 and while programming it, I encountered an issue. I followed this guide on programming the IC: High-Low Tech – Programming an ATtiny w/ Arduino 1.6 (or 1.0). When I run my code, I get this error:
In file included from C:\Users\olive\Documents\Arduino\ATtinyRemote2\ATtinyRemote2.ino:1:0:
C:\Users\olive\Documents\Arduino\libraries\SoftwareServo/SoftwareServo.h:4:22: fatal error: WProgram.h: No such file or directory
#include <WProgram.h>
^
compilation terminated.
exit status 1
Error compiling for board ATtiny.
I understand that I have to change the WProgram.h to Arduino.h, however, I’m not entirely sure how to do that. Here is the code I am using:
#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();}
Thanks for your help!