Start a new topic

Swap images via Arduino

I'm building a weather app and need to swap forecast icons at the bottom each time the weather updates. I've attached a picture for reference. When the weather refreshes, each of the 3 icons need to refresh to the related weather icon. There are 15 icons, so swapping with some sort of cover image is a pain. Is there a way to tell each one what icon it should be from Arduino?  i.e. p0 = rain, then later p0 = sunny etc?

(18.3 KB)

yes.  Assign each weather a value.  p0.pic=value

Assigning each weather its own picture resource then picno is value

Sorry.. Not sure I follow..  I am good from the Arduino side as I will just pass through the picture # based on what is parsed and pass that through, but I don't know what to do in the Nextion editor?  For example, do I create a single picture but load all icons in the editor, then dynamically change it's assignment. Or, do I have to place 15 pictures all on top of each other (which I dont want to do) and call the right one up to the top?  I feel like I am over complicating this...  

I have ~49 weather icons that 60 x 51 pixels, each as an individual gif file

These are added into the picture pane in the lower left of the Nextion Editor

Put a Picture Components 60x51 on the HMI page as p0

I can rearrange the pic id # with the up/down arrows to match the code

Then p0.pic=10 loads the cloudy picture resource #10 into the p0 picture component

I think I follow.  So, I just need to make sure all pictures are added to the project, but they do not all need to be added as separate picture components. Just one per day of the week, and I can change each with calls from the MCU?   Thanks BTW!  

Yeah, so only one Picture component for each picture you want to displayed.

In a day view, you only need the current so one picture component

In a five day view, then 5 components

Great. Thanks for your help and quick response...  I am re-building my weather project with a Nextion TFT and ESP8266 because my current ESP/Adafruit RA8875 combo keeps failing (long story related to SPI not playing well on the ESP)....   I am hoping that comms over serial will finally give me a project that does not crash every 8-12 hours (like mine does)...  

Looking good.  But I can see an issue ...

Unless we have mastered time travel,

    Retrieving historical weather for 1970 will certainly be an issue.

    ... and then temperature in Canada was in Imperial units.

And if we have mastered time travel

    ... most of the wireless internet connections will be non existent

    ... you'll need to hard connect with DataPak

LOL!  Good catch!  That is the RTC failing!  I'm looking to work with smoke signals here! forget wires and electricity!!!! :-)

I'm in New Brunswick, so when I saw your project was Canadian

... hey I just couldn't resist.

Since you like ESPs, it might be interesting to point out the Sonoff devices are ESP driven

- Itead also has ESP 8266s and the 8285s modulles should you need.

  ... and pricing is better than fair comparatively, just in case you need a replacement

As for your pics, if you getting your feed from Environment Canada, line up your picture icons in the Picture pane to match the feed, then it is an easy call to copy from the feed right into your outgoing p0.pic= assignment. 

I would also want more than just an wall icon for 41,42, and 48 - I would want a loud siren !!

Attached: Weather icon pic pack for Environment Canada's feed

(129 KB)

I'm actually no longer using the Enviro Canada feed, and instead using Weather Underground.  They only have 15 or so icons, and tornadoes is NOT one of them!  I wonder how they would represent that given we usually now get the odd tornado warning at least once per summer here in Ontario.... Thx for the icons.. I have these as well.

Hi! I am trying something like this! Can you let me see a .ino code so I can understand the way you call the different pictures from one picture object??? Thanks a lot!

Dave A has made his conditions clear

 - for a donation, he will share his code, but not without.

Follow his link to make donation

Pandering for code is frowned on.

When user wishes to share, code will already be posted.

Ok, I only need to see how to call an image... not the complete code...

Login or Signup to post a comment