Advertisement
hwthinker

Helloworld Max7219 4 in1 Nodemcu esp8266

Jan 24th, 2019
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. // Program to demonstrate the MD_Parola library
  2. // MD_MAX72XX library can be found at https://github.com/MajicDesigns/MD_MAX72XX
  3. // hello world max7219 FC16 model hardware in esp8266 edited by hwthinker
  4.  
  5. #include <MD_Parola.h>
  6. #include <MD_MAX72xx.h>
  7. #include <SPI.h>
  8.  
  9. // Define the number of devices we have in the chain and the hardware interface
  10. // NOTE: These pin numbers will probably not work with your hardware and may
  11. // need to be adapted
  12. #define HARDWARE_TYPE MD_MAX72XX::FC16_HW
  13. #define MAX_DEVICES 4
  14.  
  15. #define CLK_PIN   D5  // or SCK NODEMCU
  16. #define DATA_PIN  D7 // or MOSI NODEMCU
  17. #define CS_PIN    D8 // or SS NODEMCU
  18. //VCC   3V3 pin NODEMCU
  19.  
  20. // Hardware SPI connection
  21. MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
  22. // Arbitrary output pins
  23. // MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
  24.  
  25. void setup(void)
  26. {
  27.   P.begin();
  28.   P.displayText("Hello", PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
  29. }
  30.  
  31. void loop(void)
  32. {
  33.   P.displayAnimate();
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement