Untitled
unknown
plain_text
a year ago
1.0 kB
7
Indexable
#include <MD_Parola.h> #include <MD_MAX72XX.h> #include <SPI.h> #define MAX_DEVICES 4 #define CS_PIN 10 MD_Parola myDisplay = MD_Parola(MD_MAX72XX::FC16_HW, CS_PIN, MAX_DEVICES); int hallSensorPin = 2; volatile bool sensorTriggered = false; volatile bool messageDisplayed = false; void sensorInterrupt() { sensorTriggered = true; } void setup() { myDisplay.begin(); myDisplay.setIntensity(8); myDisplay.displayClear(); pinMode(hallSensorPin, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(hallSensorPin), sensorInterrupt, RISING); } void loop() { int sensorValue = digitalRead(hallSensorPin); if (sensorTriggered && !messageDisplayed) { myDisplay.displayScroll("STOP STOP STOP STOP ", PA_CENTER, PA_SCROLL_LEFT, 30); messageDisplayed = true; } else if (messageDisplayed) { myDisplay.displayClear(); messageDisplayed = false; sensorTriggered = false; } if (myDisplay.displayAnimate()) { myDisplay.displayReset(); } }
Editor is loading...
Leave a Comment