Open Mala2 opened 3 years ago
I'm glad you're loving it! What source are you using for the weather? If you are using one of the boards from Kickstarter/Amazon that has the integral temperature sensor, take a look at the code from this example relating to SHT21. Specifically, lines 47, 49, 71, 502-505
To modify the code that your issue was written against, I'd add:
//Add these three lines to the top of your code:
#include <SHT21.h> //https://github.com/markbeee/SHT21
SHT21 SHT21;
float temp, rh, temperatureOffset;
//Add these to the every 5 minutes function:
temp = SHT21.getTemperature()+temperatureOffset;
rh = SHT21.getHumidity();
Then take a look at the printLocaltime()
function. count
is the variable that stores what is shown on the clock:
void printLocalTime()
{
struct tm timeinfo;
if(!getLocalTime(&timeinfo)){
Serial.println("Failed to obtain time");
return;
}
Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
count=(timeinfo.tm_hour*100+timeinfo.tm_min);
}
It gets the time and stores it in a struct then sets count equal to the minutes and seconds. I believe timeinfo.tm_sec
would give you the current seconds. Then you could setup an if statement such that if seconds were between 0 and 5 or 30 and 35 then set count=temp*100+rh
else show the time and that would cause the display to show the temperature and humidity for 5 seconds every 30 seconds instead of the time. Note that this example only checks and updates the time every 5 seconds since the clock doesn't display seconds by default so you'd want to tell it to update the time every second.
I'd also look at creating a custom FastLED palette so that half the display was one color and the other was a different color to differentiate the temperature and humidity.
I hope this helps get you started in the right direction!
I am just speechless as this is the best detailed repaly I ever received. Thank you so much.
I am afraid to say that I meant to get the weather from the internet for my city, however I will definitely use one of the sensors too.
Sorry for any inconvenience I may have caused. I am working on Bluetooth Portable Speaker and I intended to use your Neo7SegmentClock. You may take a look at the GitHub link.
I will definitely appreciate any input from you and I will be happy to link your repository to mine as a reference.
Thanks a lot for your time
Hey, thanks for the kind words! I checked out your schematic, if you haven't progressed too far, I think the ESP32 could handle a lot of the work done by the ATMEGAs and bluetooth module. If you have the clock board with the ESP32 module already soldered out, you could use the DAC outputs to drive an amplifier directly (though they are only 8bit so sound quality may not be 100%) or drive an external DAC. I found a few references for "ESP32 bluetooth speaker" For pulling the weather from the internet, look up ESP32 weather station examples for ways to pull in the data externally.
Thanks a lot. I will put that into consideration. The thing I am not that good at coding but I will definitely start working on that area. Thanks again for helping the open source community 😄
Thanks for such an awesome project. I love it !
I was wondering if there is a possibility to add weather temperature to be displayed every 30s?
Thanks again