The MatrixPortal's pinout, and its learning guide, have these buttons mapped to Arduino Pins 2 & 3, adding "...The up and down buttons do not have any pull-up resistors connected to them and pressing either of them pulls the input low.."
Using a simple code (below), and reading them as analogRead in case there was an issue with bouncing or something, shows them always LOW, regardless of pressing them or not.
What am I missing?
Thanks!!
Code: Select all
#include <Adafruit_Protomatter.h>
uint8_t addrPins[] = {17, 18, 19, 20};
uint8_t rgbPins[] = {7, 8, 9, 10, 11, 12};
uint8_t clockPin = 14;
uint8_t latchPin = 15;
uint8_t oePin = 16;
Adafruit_Protomatter matrix(32, 6, 1, rgbPins, sizeof(addrPins), addrPins, clockPin, latchPin, oePin, true);
void setup() {
Serial.begin(115200);
ProtomatterStatus status = matrix.begin();
pinMode(2, INPUT); //placing these before or after the matrix initialization makes no difference
pinMode(3, INPUT);
}
void loop() {
Serial.print(analogRead(2));
Serial.print(",");
Serial.println(analogRead(3));
}
Code: Select all
18:19:17.524 -> 77,74
18:19:17.524 -> 91,73
18:19:17.524 -> 80,73
18:19:17.524 -> 77,72
18:19:17.524 -> 77,68
18:19:17.524 -> 70,91
18:19:17.524 -> 90,78
18:19:17.524 -> 82,76
18:19:17.524 -> 79,74
18:19:17.524 -> 89,73
18:19:17.524 -> 81,72
18:19:17.524 -> 79,72
18:19:17.524 -> 77,68
18:19:17.524 -> 56,69
18:19:17.524 -> 66,69
18:19:17.524 -> 73,70
18:19:17.524 -> 87,72
18:19:17.524 -> 79,72
18:19:17.524 -> 77,71
18:19:17.524 -> 78,71
18:19:17.524 -> 51,84
18:19:17.524 -> 67,76
18:19:17.524 -> 74,93
18:19:17.524 -> 92,80
18:19:17.524 -> 96,78
18:19:17.524 -> 85,75
18:19:17.524 -> 79,72
18:19:17.524 -> 77,73
18:19:17.524 -> 53,67
18:19:17.524 -> 66,70
18:19:17.524 -> 72,71
18:19:17.524 -> 74,72
18:19:17.524 -> 89,73
18:19:17.524 -> 81,72