#include <IRremote.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#define RECV_PIN 2 // Signal Pin of IR receiver
#define CLK_PIN 10
#define CS_PIN 11
#define DATA_PIN 12
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 3
IRrecv irrecv(RECV_PIN);
MD_Parola led = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
uint8_t scroll;
void setup() {
irrecv.enableIRIn(); // Start the receiver
led.begin();
scroll = PA_SCROLL_LEFT;
}
void loop() {
if (irrecv.decode()) {
switch (irrecv.decodedIRData.command) {
case 2: { // Plus
scroll = PA_SCROLL_UP;
break;
}
case 152: { // Minus
scroll = PA_SCROLL_DOWN;
break;
}
case 224: { // Previous
scroll = PA_SCROLL_LEFT;
break;
}
case 144: { // Next
scroll = PA_SCROLL_RIGHT;
break;
}
}
irrecv.resume();
}
if (led.displayAnimate()) {
led.displayText("Wokwi", PA_CENTER, 100, led.getPause(), scroll, scroll);
}
}