Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Buttons pin number array
- byte Btns[16] = {13,12,14,27,26,25,33,32,15,4,16,17,18,19,22,23};
- //VarPots pin number array
- byte Pots[4] = {35, 34, 39, 36};
- void setup()
- {
- Serial.begin (115200);
- for (int i = 0; i<16; i++)
- {
- pinMode(Btns[i], INPUT_PULLUP);
- }
- }
- void loop()
- {
- //VarPots(); //uncomment this line to test the potentiometers
- //Buttons(); //uncomment this line to test the buttons
- }
- void Buttons ()
- {
- for (int i = 0; i<16; i++)
- {
- if (digitalRead(Btns[i]) == LOW)
- {
- Serial.print ("Button "); Serial.print (i+1); Serial.println (" ON");
- }
- }
- }
- void VarPots ()
- {
- for (int i = 0; i<4; i++)
- {
- Serial.print ("Pot "); Serial.print (i+1);
- Serial.print (" / Value: "); Serial.print(analogRead(Pots[i]));
- Serial.print (" | ");
- }
- Serial.println();
- }
Add Comment
Please, Sign In to add comment