I have sucessfully burned the bootloader onto the Attiny85v using the Arduino as an ISP.
When I try to verify my code, i get a compile error message. I was able to compile a simple blink sketch, but this code will not compile for some reason.
This is the code, which has been shortened to 5 arrays instead of 13 due to posting limitations:
long lastTime = 0;
const int RPIN = 0; //9 or Pin 0, physical pin 5
const int GPIN =1; //11 or Pin 1, physical pin 6
const int BPIN =4; //10 or or Pin 4, physical pin 3
const int SWITCHPIN = 2; //A4 or Pin 2, physical pin 7
const int potPin = 3; //A3 or Pin 3, physical pin 2
int potVal = 0;
int countArray[] = {150,106,120};
int maxSwitch = 4;
int currentPlace = 0;
int count = 0;
boolean pressed = false;
//150
prog_uchar PROGMEM rArray0[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
prog_uchar PROGMEM gArray0[] = {50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,
9,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50};
prog_uchar PROGMEM bArray0[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,
46,47,48,49,50,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int hArray0[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //25
};
//106
prog_uchar PROGMEM rArray1[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
prog_uchar PROGMEM gArray1[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
prog_uchar PROGMEM bArray1[] = {100,99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81,80,79,78,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,60,59,58,57,56,55,54,53,52,51,
50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,0,0,0,0,0};
int hArray1[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0};
//120
prog_uchar PROGMEM rArray2[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
prog_uchar PROGMEM gArray2[] = {0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,
20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20};
prog_uchar PROGMEM bArray2[] = {100,0,98,0,96,0,94,0,92,0,90,0,88,0,86,0,84,0,82,0,80,0,78,0,76,0,74,0,72,0,70,0,68,0,66,0,64,0,62,0,60,0,58,0,56,0,54,0,52,0,
50,0,48,0,46,0,44,0,42,0,40,0,38,0,36,0,34,0,32,0,30,0,28,0,26,0,24,0,22,0,20,0,18,0,16,0,15,0,14,0,13,0,12,0,11,0,10,0,9,0,8,0,7,0,6,0,5,0,4,0,3,0,2,0,1,0,0,0,0,0};
int hArray2[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //25
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //20
void setup(){
Serial.begin(9600);
pinMode(RPIN,OUTPUT);
pinMode(GPIN,OUTPUT);
pinMode(BPIN,OUTPUT);
pinMode(SWITCHPIN,INPUT);
pinMode(potPin,INPUT);
}
void checkBtn(){
boolean switcher = digitalRead(SWITCHPIN);
if(!pressed && switcher){
pressed = true;
currentPlace++;
count = 0;
lastTime = millis();
}
if(pressed && !switcher){
pressed = false;
}
}
checkBtn();
if(lastTime == 0){
lastTime = millis();
}
Serial.print(" count: ");
Serial.print(count);
Serial.print(" potVal: ");
Serial.println(hArray0[count] + potVal/4);
//////
if(lastTime + hArray0[count] + potVal/4 < millis() && currentPlace == 0){
analogWrite(RPIN,pgm_read_byte(&(rArray0[count])));
analogWrite(GPIN,pgm_read_byte(&(gArray0[count])));
analogWrite(BPIN,pgm_read_byte(&(bArray0[count])));
lastTime = millis();
count = count + 1;
if(count >= countArray[currentPlace]){
count = 0;
}
}
///////
if(lastTime + hArray1[count] + potVal/4 < millis() && currentPlace == 1){
analogWrite(RPIN,pgm_read_byte(&(rArray1[count])));
analogWrite(GPIN,pgm_read_byte(&(gArray1[count])));
analogWrite(BPIN,pgm_read_byte(&(bArray1[count])));
lastTime = millis();
count = count + 1;
if(count >= countArray[currentPlace]){
count = 0;
}
}
//////
if(lastTime + hArray2[count] + potVal/4 < millis() && currentPlace == 2){
analogWrite(RPIN,pgm_read_byte(&(rArray2[count])));
analogWrite(GPIN,pgm_read_byte(&(gArray2[count])));
analogWrite(BPIN,pgm_read_byte(&(bArray2[count])));
lastTime = millis();
count = count + 1;
if(count >= countArray[currentPlace]){
count = 0;
}
}
if(currentPlace >= maxSwitch){
currentPlace = 0;
}
}
Any idea what might be going wrong?
thank you so much for your help!