I'm trying to make a Boolean list for a project using LEDs and I don't now how to finish the rest of the code, if you know of any guides that could help that would be great.
There are 16 LEDs and I am linking them to a keypad.
#include <Keypad.h>
int latchPin = 12;
int clockPin = 11;
int dataPin = 13;
const byte ROWS = 4;
const byte COLS = 4;
char Key = 0;
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3, 2};
bool LEDlist[]={false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false,}// This is the bool list
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup(){
{
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}
Serial.begin(9600);
}
void loop(){
char customKey = customKeypad.getKey();
LEDlist[]={false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false,}
if(customKeypad.isPressed('1')){
Serial.println("1");
LEDlist[0] = true
}
if(customKeypad.isPressed('2')){
Serial.println("2");
LEDlist[1] = true
}
if(customKeypad.isPressed('3')){
Serial.println("3");
LEDlist[2] = true
}
if(customKeypad.isPressed('4')){
Serial.println("4");
LEDlist[3] = true
}
if(customKeypad.isPressed('5')){
Serial.println("5");
LEDlist[4] = true
}
if(customKeypad.isPressed('6')){
Serial.println("6");
LEDlist[5] = true
}
if(customKeypad.isPressed('7')){
Serial.println("7");
LEDlist[6] = true
}
if(customKeypad.isPressed('8')){
Serial.println("8");
LEDlist[7] = true
}
if(customKeypad.isPressed('9')){
Serial.println("9");
LEDlist[8] = true
}
if(customKeypad.isPressed('0')){
Serial.println("0");
LEDlist[9] = true
}
/*if ("A" == customKeypad.getKey()){
Serial.println("A");
LEDlist[10] = true
}
if ("B" == customKeypad.getKey()){
Serial.println("B");
LEDlist[11] = true
}
if ("C" == customKeypad.getKey()){
Serial.println("C");
LEDlist[12] = true
}
if ("D" == customKeypad.getKey()){
Serial.println("D");
LEDlist[13] = true
}*/
if(customKeypad.isPressed('#')){
Serial.println("#");
LEDlist[14] = true
}
if(customKeypad.isPressed('*')){
Serial.println("*");
LEDlist[15] = true
}
{
char keypressed = customKeypad.getKey();
if (keypressed != NO_KEY)
{
Serial.println(keypressed);
}
}
}
sketch_apr11a.ino (4.48 KB)