Hier is een youtube video. van de 8 matrices in actie.
De code van de video is hier. Vergeet niet de correcte 1632.CPP and 1632.H file voor de matrices.
dat is diegene die support 8 matrices.
Welke kan gevonden worden op github.
Ik hoop dat iemand er wat aan heeft om er ook meer dan 4 werkend te krijgen.
//working on version 0022
#include "Wire.h"
#include "RTClib.h"
#include "SPI.h"
#include "HT1632.h"
#include "DHT.h"
#define DHTPIN 12 // what pin we're connected to
#define DATA 2
#define WR 3
#define CS 4
#define CS2 5
#define CS3 6
#define CS4 7
#define CS5 8
#define CS6 9
#define CS7 10
#define CS8 11
#define DHTTYPE DHT22 // DHT 22 (AM2302)
// Connect pin 1 (on the left) of the sensor to +5V
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
// use this line for single matrix
//HT1632LEDMatrix matrix = HT1632LEDMatrix(DATA, WR, CS);
// use this line for two or more matrices!
HT1632LEDMatrix matrix = HT1632LEDMatrix(DATA, WR, CS, CS2, CS3, CS4, CS5, CS6, CS7, CS8);
//RTC_DS1307 RTC;
RTC_Millis RTC;
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
Wire.begin();
RTC.begin(DateTime(__DATE__, __TIME__));
matrix.begin(HT1632_COMMON_16NMOS);
dht.begin();
matrix.println("DHTxx test!");
matrix.writeScreen();
delay(2500);
matrix.fillScreen();
delay(2500);
matrix.clearScreen();
}
void loop () {
matrix.setTextSize(1); // size 1 == 8 pixels high
matrix.setTextColor(1); // 'lit' LEDs
matrix.setCursor(0, 0); // start at top left, with one pixel of spacing
DateTime now = RTC.now();
matrix.print("Date:");
if (now.month() < 10) matrix.print("0"); // Check if we need to add leading zero
matrix.print(now.month(), DEC);
matrix.print('/');
if (now.day() < 10) matrix.print("0"); // Check if we need to add leading zero
matrix.print(now.day(), DEC);
matrix.print('/');
matrix.print(now.year(), DEC);
matrix.print(' ');
matrix.setCursor(0, 8); // next line, 8 pixels down
matrix.print("Time:");
if (now.hour() < 10) matrix.print("0"); // Check if we need to add leading zero
matrix.print(now.hour(), DEC);
matrix.print(':');
if (now.minute() < 10) matrix.print("0"); // Check if we need to add leading zero
matrix.print(now.minute(), DEC);
matrix.print(':');
if (now.second() < 10) matrix.print("0"); // Check if we need to add leading zero
matrix.print(now.second(), DEC);
matrix.println();
matrix.writeScreen();
delay(3000);
matrix.clearScreen();
matrix.setTextSize(1); // size 1 == 8 pixels high
matrix.setTextColor(1); // turn off LEDs
matrix.setCursor(97, 0); // start at top left, with one pixel of spacing
//DateTime now = RTC.now();
matrix.print("Time:");
if (now.hour() < 10) matrix.print("0"); // Check if we need to add leading zero
matrix.print(now.hour(), DEC);
matrix.print(':');
if (now.minute() < 10) matrix.print("0"); // Check if we need to add leading zero
matrix.print(now.minute(), DEC);
matrix.print(':');
if (now.second() < 10) matrix.print("0"); // Check if we need to add leading zero
matrix.print(now.second(), DEC);
matrix.println();
matrix.setCursor(97, 8); // next line, 8 pixels down
matrix.print("Date:");
if (now.month() < 10) matrix.print("0"); // Check if we need to add leading zero
matrix.print(now.month(), DEC);
matrix.print('/');
if (now.day() < 10) matrix.print("0"); // Check if we need to add leading zero
matrix.print(now.day(), DEC);
matrix.print('/');
matrix.print(now.year(), DEC);
matrix.print(' ');
matrix.writeScreen();
delay(3000);
matrix.clearScreen();
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
float t = dht.readTemperature();
// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t) || isnan(h)) {
Serial.println("Failed to read from DHT");
} else {
matrix.setTextSize(1); // size 1 == 8 pixels high
matrix.setTextColor(1); // turn off/on LEDs
matrix.setCursor(1, 0); // start at top left, with one pixel of spacing
matrix.print("Humidity = ");
matrix.print(h);
matrix.print(" %\t");
matrix.setCursor(1, 8); // start at top left, with eight pixels down
matrix.print("Temperature = ");
matrix.print(t);
matrix.println(" *C , ");
matrix.setCursor(144, 8); // start at the top left and 138 pixels right, with eight pixels down
matrix.print(t*1.8+32);matrix.println(" *F");
matrix.writeScreen();
delay(5000);
matrix.clearScreen();
}
}