Created
October 18, 2022 20:15
-
-
Save binocularity/a3c6e95af3905fca9a0c23eaa7988b7e to your computer and use it in GitHub Desktop.
@cheerlights dynamic updating with dropped network mangement in @WolframResearch Mathematica from @binocularity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
req = HTTPRequest[ | |
"http://api.thingspeak.com/channels/1417/field/2/last.json"]; | |
f[] := ( | |
colour = HatchFilling[]; | |
reqStat = Quiet[ URLRead[ req, TimeConstraint -> 2]]; | |
If[ Not[FailureQ[reqStat]], | |
( rawData = Import[req]; | |
colour = RGBColor[Lookup[ rawData, "field2"]]; ) | |
]; | |
colour | |
) | |
CreateDocument[ Dynamic[ Graphics[{f[], Rectangle[{0.0, 0.0}]}], UpdateInterval -> 8] ]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NB you need to copy and paste this into Mathematica it is not a .nb notebook.
NB 2 it should work with Wolfram Engine/Mathematica free on the Raspberry PI but I have not tested it.