Untitled
unknown
plain_text
a year ago
957 B
6
Indexable
#include <MD_Parola.h> #include <MD_MAX72xx.h> #include <SPI.h> #define MAX_DEVICES 4 #define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW #define CLK_PIN 13 #define DATA_PIN 11 #define CS_PIN 10 int hallSensorPin = 2; volatile bool sensorTriggered = false; MD_Parola myDisplay = MD_Parola(MD_MAX72XX::FC16_HW, CS_PIN, MAX_DEVICES); void sensorInterrupt() { sensorTriggered = !digitalRead(hallSensorPin); // Read the sensor state in the interrupt } void setup() { myDisplay.begin(); myDisplay.setIntensity(8); myDisplay.displayClear(); pinMode(hallSensorPin, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(hallSensorPin), sensorInterrupt, FALLING); // Attach interrupt on CHANGE } void loop() { if (sensorTriggered) { myDisplay.displayScroll("STOP STOP STOP STOP", PA_CENTER, PA_SCROLL_LEFT, 25); sensorTriggered = false; } if (myDisplay.displayAnimate()) { myDisplay.displayClear(); } }
Editor is loading...
Leave a Comment