So, I recently built myself a physical PICO-8 console that hangs on the wall. It switches to a screensaver mode when it's not in use, and switches to splore to play games when someone connects a joystick:
(ignore the flickering, that's just the refresh rate)
I had the idea to periodically display a weather dashboard in between the different screensaver carts it cycles through when it's not being used. So, I went searching the BBS for options, only to find none exist. When I began exploring why, I quickly learned that interacting with APIs is impossible directly, and that I would need to feed PICO-8 the weather data at runtime. For my purposes, that's actually not a problem at all, since I can set up a cron job to refresh the data in a text file, and then just feed the updated file into the cart each time it runs.
The problem really is, I'm not a lua dev. I know this about myself. I'm not good at it, and I'm not patient enough to become good at it. The moment I encounter the need for an array, my brain fuzzes over and I move on. So, I'd love to collaborate! I have the basic building blocks of what I have in mind ready to go. I have example code to work from to get data from text file into the cart. I have the weather data API and sample calls I can make. I also have an example of the dashboard visuals I'm aiming for: https://github.com/lmarzen/esp32-weather-epd
I can make the sprites (from these) and help make UI decisions. But what I can't really do (well) is sling the necessary code to turn the idea into reality.
It shouldn't actually be that complicated of a cart, honestly. The hardest part will be parsing the data fed in from the text file, and then acting on it to render the weather dashboard.
If you've been curious about learning how to pull in data to pico8 via serial/stdin and in the process help fill a gap on the bbs (especially for folks like me who build pico-8 arcade cabinets), let's work together. :)
I might be able to help. I just finished my first game with pico and this sounds like an interesting problem to solve. I cannot promise to solve this but I can at least do some research on a solution.
I have no clue what environment your pico dashboard is running in. Linux? You say that you can use a cronjob to write updated weather data to a file. can you also automate restarting the dashboard, say, every 24 hours? This way we could read the fresh data from the text file via a simple #include statement. it just has to be written into a Lua friendly format. I assume you get the weather data in json format? csv? xml?
with this service you can get weather data in json format
here I found a lib which parses json to Lua tables.
so this is how I imagine this:
setup a cron job which curls the weather data as json
write the json to a "weatherdata.lua" file, wrapping the json within
weather_data = ' "json goes here"'as a Lua string
include weatherdata.lua in your dashboard code
json(weather_data)which returns the data as a table
- get the data your are interested in from the table
In short, yes. You could use one of several weather APIs to obtain the source data needed for the cart.
That part is not the hard part (for me, at least). It's writing the lua code for the cart.
The way my linux-based (Raspbian) LED matrix PICO8 machine works is that it boots up automatically into a screensaver routine which rotates through a set list of carts non-interactively. This new weather dashboard cart would simply be added into the rotation.
When players want to play games, they power on one of the controllers which triggers the system to launch splore. When they power off the controllers, it switches back to screensaver mode.
Each screensaver cart runs for whatever interval is set in the script. I think mine's set for 10 minutes, before a new screensaver cart is run. And it keeps looping until it either detects a controller or the system is powered off.
So, yes, each time the weather cart is run, it would pull the data from the json file and display it.
if you can come up with a ui layout and provide the sprites I could glue together some code to display the correct information based on the json data.
I am about to wrap up my little game project here which takes me 2-3 more days. after that I could invest a little time in this.
This is a really neat idea. I like the concept of the PICO8 playable wall art...let alone the weather station idea.
There doesn't need to be too many cooks in the kitchen here, but I'd be interested in helping too if there's a need for more brains.
I'd like to pick your brain about making the wall art screen console.
@morningtoast: Happy to share. I took pictures and notes with the intent of creating an Instructables post for it so folks can build their own, I just haven't had the time yet to sit down and do it. But I will try to prioritize it since there's interest.
To make it easier, I intentionally chose standard parts and software that are usable entirely off the shelf (no need to custom compile anything). The rest is just bash scripts which I will be sharing in a git repo, and some light linux config.
Here's a potato-quality video demonstrating the controller automation, if you're curious:
[Please log in to post a comment]