so i got this neat 7 segment display module, and it works fine using SevSeg library, so i thought id add the dht11 sensor, eventually make a little weather station. so the dht11 works fine over serial, 7 segment display works fine for a counter, but i cant seem to send the dht to the 7seg. whats weird is i get the leds to blink either randomly, or in their test pattern, which i am thoroughly confused by.
#include <DHT.h>
#include <DHT_U.h>
#include <SevSeg.h>
SevSeg sevseg; //Instantiate a seven segment object
DHT dht(A0, DHT11);
byte numDigits = 4;
byte digitPins[] = {0,1,2,3};
byte segmentPins[] = {4,5,6,7,8,9,10,11};
bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
byte hardwareConfig = P_TRANSISTORS; // See README.md for options
bool updateWithDelays = false; // Default 'false' is Recommended
bool leadingZeros = true; // Use 'true' if you'd like to keep the leading zeros
bool disableDecPoint = true; // Use 'true' if your decimal point doesn't exist or isn't connected
void setup() {
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
updateWithDelays, leadingZeros, disableDecPoint);
sevseg.setBrightness(90);
dht.begin();
}
void loop() {
sevseg.setNumber(8008);
sevseg.refreshDisplay();
delay(1000);
sevseg.setNumber(880);
sevseg.refreshDisplay();
delay(1000);
/*
delay(1000);
unsigned long h = dht.readHumidity();
sevseg.setNumber(h);
delay(100);
sevseg.refreshDisplay();
delay(1000);
sevseg.setNumber(dht.readTemperature(true));
delay(100);
sevseg.refreshDisplay();
*/
}
the commented part of the loop has segments light up randomly, so i commented it and tried to get it to at least say something specfic. that cycles through each segment A-G, instead. i am confused because i would expect an error in this code to at least cycle between 2 things, not a full rotation. it still updates depending on how long a delay i set too. i am aware that usb communication uses pins 0 and 1, those are the left-most digits and are disconnected. 60 second countdown timer displays just fine, but i cant seem to manually set the display, im about to peel my face off with some of these libraries