Pluto Guru
 Joined: 09/06/2017 Location: FinlandPosts: 411 |
| Posted: 08:20am 14 Mar 2023 |
|
|
|
Peter, here is the program and the options in use.
'openweathermap CLS Dim buff%(512) Dim APIKEY$="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
WEB ntp 2
Dim report$="weather?q=Porvoo,FI" Dim b$= "GET /data/2.5/"+report$+"&APPID="+APIKEY$+Chr$(10)+Chr$(13) SETTICK 1000*60,Klocka Klocka DO update=0 report$="weather?q=Porvoo,FI" b$= "GET /data/2.5/"+report$+"&APPID="+APIKEY$+Chr$(10)+Chr$(13) WEB open tcp client "api.openweathermap.org",80 WEB TCP CLIENT REQUEST b$,buff%(),10000 WEB close tcp client Print "Weather for " + Json$(buff%(),"name") Print "Temperature is ",Val(Json$(buff%(),"main.temp"))-273 Print "Pressure is ",Json$(buff%(),"main.pressure") Print Json$(buff%(),"weather[0].description") TEXT 0,10,"Hemma:",,,2,rgb(blue),rgb(White) text 0,40,"Temperatur:"+str$(Val(Json$(buff%(),"main.temp"))-273)+"'C",,,1
TEXT 0,60,"Lufttryck: "+Json$(buff%(),"main.pressure")+"mBar" text 0,80,Json$(buff%(),"weather[0].description") WindDir TEXT 0,100,"Vind: "+Json$(buff%(),"wind.speed")+" m/s "+riktning$ TEXT 0,120,"Regn: "+Json$(buff%(),"rain.1h")+" mm/h" Update=1 pause 60000*2 Update=0 report$="weather?q=Kaskinen,FI" b$= "GET /data/2.5/"+report$+"&APPID="+APIKEY$+Chr$(10)+Chr$(13) WEB open tcp client "api.openweathermap.org",80 WEB TCP CLIENT REQUEST b$,buff%(),10000 WEB close tcp client Print "Weather for " + Json$(buff%(),"name") Print "Temperature is ",Val(Json$(buff%(),"main.temp"))-273 Print "Pressure is ",Json$(buff%(),"main.pressure") Print Json$(buff%(),"weather[0].description") TEXT 160,10,"Holmin:",,,2,rgb(blue),rgb(White) text 160,40,"Temperatur:"+str$(Val(Json$(buff%(),"main.temp"))-273)+"'C" TEXT 160,60,"Lufttryck: "+Json$(buff%(),"main.pressure")+"mBar" text 160,80,Json$(buff%(),"weather[0].description") WindDir TEXT 160,100,"Vind: "+Json$(buff%(),"wind.speed")+" m/s "+riktning$ TEXT 160,120,"Regn: "+Json$(buff%(),"rain.1h")+" mm/h" Update=1 'Klocka
pause 60000*2 loop end
SUB WindDir grad=val(+Json$(buff%(),"wind.deg")) riktning$="" if grad>337.5 or grad<=22.5 then riktning$="Nord" if grad>22.5 and grad<=67.5 then riktning$="N-O" if grad>67.5 and grad<=112.5 then riktning$="Ost" if grad>112.5 and grad<=157.5 then riktning$="S-O" if grad>157.5 and grad<=202.5 then riktning$="Syd" if grad>202.5 and grad<=247.5 then riktning$="S-V" if grad>247.5 and grad<=292.5 then riktning$="V" if grad>292.5 and grad<=337.5 then riktning$="N-V" end sub
sub Klocka If Update then Tid$=left$(time$,5) text mm.hres/2,mm.vres*7/8,Tid$,CM,,3,rgb(blue),rgb(white) end if end sub
option list PicoMite MMBasic Version 5.07.07a24 OPTION SYSTEM SPI GP18,GP19,GP16 OPTION CPUSPEED (KHz) 252000 OPTION LCDPANEL ILI9341, LANDSCAPE,GP17,GP14,GP13 OPTION WIFI ZZZZZZZZZ, *********** OPTION TCP SERVER PORT 80 OPTION TOUCH GP12,GP11 GUI CALIBRATE 0, 3921, 3913, -894, -632 >
/Pluto |