Im currently working on a Keyboard firmware.
I'll attach how it looks like right now.
but when i try to compile it, it gives me the error message:
note: in expansion of macro 'HIGH'
and it doesn't even tell me what's wrong(the red line indicator doesnt show up)
plz help
Thanks in advance
byte rowp[6]={13,14,15,16,17,18}; //connect rows to pins
byte colp[15]={19,20,21,22,23,24,25,26,27,28,29,30,31,32,33}; //connect columns to pins
byte ledColp[15]={35,36,37,38,39,40,41,42,43,44,45,46,47,48,49}; //connect led columns to pins
byte ledRowp[6]={2,3,4,5,6,7}; //connect led rows to pins
byte brightnessToggleKey=1,overrideSwitch=51; //connect the key next to delete directly to pin 1 and ground
char layout[90]={'ESC','KEY_F1','KEY_F2','KEY_F3','KEY_F4','KEY_F5','KEY_F6','KEY_F7','KEY_F8','KEY_F9','KEY_F10','KEY_F11','KEY_F12','KEY_DELETE','KEY_PAGE_UP','(char)96','1','2','3','4','5','6','7','8','9','0','-','=','KEY_BACKSPACE','KEY_PAGE_DOWN','KEY_TAB','q','w','e','r','t','y','u','i','o','p','[',']','(char)92','KEY_HOME','KEY_LEFT_CTRL','a','s','d','f','g','h','j','k','l','(char)59','(char)39','KEY_RETURN','KEY_END','KEY_CAPS_LOCK','KEY_LEFT_SHIFT','z','x','c','v','b','n','m','(char)44','(char)46','/','KEY_RIGHT_SHIFT','KEY_UP_ARROW','KEY_RETURN','KEY_LEFT_CTRL','(char)0','(char)0x5B','(char)0','(char)0','(char)32','(char)0','(char)0','(char)0','KEY_RIGHT_ALT','(char)0','KEY_RIGHT_CTRL','KEY_LEFT_ARROW','KEY_DOWN_ARROW','KEY_RIGHT_ARROW'}; //define keymap
char FnLayout[90]={'(char)0','(char)0xAD','(char)0xAE','(char)0xAF','(char)0','(char)0xB3','(char)0xB2','(char)0xB1','(char)0xB0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0x04','(char)0','(char)0','(char)0','(char)0xA6','(char)0xA7','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0x01','(char)0','(char)0x02','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0','(char)0'}; //define keymap of function layer
bool pressedKey[90],pressedKeyOld[90],backlitKeys[90],backlitKeysRow1[15],backlitKeysRow2[15],backlitKeysRow3[15],backlitKeysRow4[15],backlitKeysRow5[15],backlitKeysRow6[15];
byte brightness;
bool brightnessToggleKeyState,brightnessToggleKeyStateOld;
void setup(){
byte temp; //create temporary variable to use in for loops
for(temp=13;temp<19;temp++){
pinMode(temp,INPUT_PULLUP);
} //set row pins to input_pullup
for(temp=19;temp<34;temp++){
pinMode(temp,OUTPUT);
digitalWrite(temp,HIGH);
} //set column pins to output(to use them as temporary grounds) and write them high(to avoid making it into ground)
for(temp=2;temp<8;temp++){
pinMode(temp,OUTPUT);
} //set led row pins to output. these pins are capable of pwm outputs
for(temp=35;temp<50;temp++){
pinMode(temp,OUTPUT);
digitalWrite(temp,HIGH);
} //set led column pins to output(to use them as temporary grounds) and write them high(to avoid making it into ground)
pinMode(brightnessToggleKey,INPUT_PULLUP); //initialize the push button(which is actually a switch but whatever it acts like a pushbutton)
Keyboard.begin();
Mouse.begin();
}
void loop(){
configureBacklitKeys();
scanForPressedKeys();
outputToPC();
configureBacklightBrightness;
}
void scanForPressedKeys(){
for(byte col=0;col<90;col++){
digitalWrite(colp[col],LOW);
for(byte row=0;row<6;row++){
if(digitalRead(rowp[row])==LOW){
pressedKey[(row-1)*15+col-1]=HIGH;
}else{
pressedKey[(row-1)*15+col-1]=LOW;
}
}
digitalWrite(colp[col],HIGH);
}
for(byte i = 0;i<90;i++){
pressedKeyOld[i]=pressedKey[i];
}
}
void outputToPC(){
if(pressedKey[71]==LOW&&pressedKey[80]==LOW){
for(byte i=0;i<90;i++){
if(pressedKey[i]!=pressedKeyOld[i]){
if(pressedKey[i]==HIGH){
Keyboard.press(layout[i]);
}else{
Keyboard.release(layout[i]);
}
}
}
}else{
for(byte i=0;i<90;i++){
if(pressedKey[i]!=pressedKeyOld[i]){
if(pressedKey[i]==HIGH){
Keyboard.press(FnLayout[i]);
}else{
Keyboard.release(FnLayout[i]);
}
}
}
}
}
void configureBacklightBrightness(){
brightnessToggleKeyStateOld=brightnessToggleKeyState;
if(digitalRead(brightnessToggleKey)==LOW){
brightnessToggleKeyState=HIGH;
}else{
brightnessToggleKeyState=LOW;
}
if(brightnessToggleKeyState!=brightnessToggleKeyStateOld&&brightnessToggleKeyState==HIGH){
if(brightness!=255){
brightness+=51;
}else{
brightness=0;
}
}
}
void configureBacklitKeys(){
if(pressedKey[71]==HIGH&&pressedKey[80]==HIGH){
while(digitalRead(brightnessToggleKey)==HIGH){
scanForPressedKeys();
for(byte i=0;i<90;i++){
if(pressedKey[i]!=pressedKeyOld[i]&&pressedKey==HIGH){
backlitKeys[i]=pressedKey[i];
}
}
convertBacklitKeysArray();
}
}
}
void convertBacklitKeysArray(){
for(byte i=0;i<90;i++){
backlitKeysRow1[i]=backlitKeys[i];
}
for(byte i=15;i<30;i++){
backlitKeysRow2[i-15]=backlitKeys[i];
}
for(byte i=30;i<45;i++){
backlitKeysRow3[i-30]=backlitKeys[i];
}
for(byte i=45;i<60;i++){
backlitKeysRow4[i-45]=backlitKeys[i];
}
for(byte i=60;i<75;i++){
backlitKeysRow5[i-60]=backlitKeys[i];
}
for(byte i=75;i<90;i++){
backlitKeysRow6[i-75]=backlitKeys[i];
}
}
void outputBacklight(){
}
EDIT:
sry. it was a simple mistake.
i didnt index pressedKey.
that's the second time i posted without thinking.
ill try not to let it happen again
Edit: CODE TAGS {sobs}