Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : WebMite Question
Author | Message | ||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
When I use "WEB NTP +10" and get the message "got ntp response: 17/04/2024 08:26:04" how do I access this info to set the RTC? or does it automatically update the Time$ and Date$ and I can use that to RTC SETTIME ? 0A47 Edited 2024-04-17 08:34 by OA47 |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
No need. That should happen automatically. I haven't tried with an external RTC but it works for the built-in RTC. Jim VK7JH MMedit MMBasic Help |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
After "got ntp response: 17/04/2024 08:26:04" has set Time$ and Date$ do:- RTC SETTIME DateTime$(now) |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
Thanks Jim, on thinking about it, I dont think I need an external RTC if I can keep the clock updated from the WEB. |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
Thanks Phil, I will try to remember DateTime$(Now) 0A47 |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
Can someone help me with this response? "[CYW43] do_ioctl(2, 263, 16): timeout" I believe it is related to the WEB NTP command. 0A47 |
||||
Malibu Senior Member Joined: 07/07/2018 Location: AustraliaPosts: 228 |
...is a problem I've been chasing for ages, but it's not just restricted to the NTP command. Can't narrow it down any more than that for you, sorry... I'm still trying to nut the 'inner workings' out thus far... John |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
Thanks Malibu I will plod on. 0A47 |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
Here is my next stumbling block: mm.ver=5.08 Dim Web$="api.openweathermap.org" Const Key="???????????????????????????" Const Query="GET/data/2.5/WEATHER?q=Paris,fra&APPID="+Key+Chr$(13)+Chr$(10) Dim buff%(4096/8) Dim temp WEB OPEN TCP CLIENT Web$, 80 WEB TCP CLIENT REQUEST Query, buff%() WEB CLOSE TCP CLIENT temp=Val(Json$(buff%(),"main.temp")) Returns tcp address 38.89.70.158 Connected [113] temp=Val(Json$(buff%(),"main.temp")) Error : Invalid JSON data Help please 0A47 Edited 2024-04-17 16:10 by OA47 |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
GET /data You need a space between GET and the / and the returned temperature might be in Kelvin so -273 Jim Edited 2024-04-17 17:22 by TassyJim VK7JH MMedit MMBasic Help |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6784 |
"[CYW43] do_ioctl(2, 263, 16): timeout" was a problem for me too. I don't think it's WEB NTP though as you can trap a connection error there very effectively (and connections usually work first time for me). IIRC it was related to using Telnet and I had to shut Tera Term down and reconnect. (It was just one of the problems so I may be confused about what I did in each case!). Most problems needed a reset button on the Pico W. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
Thanks Mick. Thanks Jim, I re-inserted the space after GET and the error is no longer but the string returned is still empty. Print Json$(buff%(),"main.temp") Does not print anything Where would I find a list of the key words that should be stored in the string? 0A47 Edited 2024-04-17 18:22 by OA47 |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9111 |
add the line LONGSTRING PRINT buff%() Then you can see what, if anything, has been received |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
Thanks Peter, I found the list of JSON words on the website and somewhere along the line I had typed the word weather in caps and that wasn't liked. I am making progress again 0A47 tcp address 38.89.70.158 Connected {"coord":{"lon":-80.6081,"lat":28.0836},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02n"}],"base":"stations","main":{"temp":294.09,"feels_like":294.35,"temp_min":290.39,"temp_max":296.46,"pressure":1020,"humidity":81},"visibility":10000,"wind":{"speed":4.63,"deg":130},"clouds":{"all":20},"dt":1713343124,"sys":{"type":1,"id":4922,"country":"US","sunrise":1713351278,"sunset":1713397720},"timezone":-14400,"id":4163971,"name":"Melbourne","cod":200} Current Temp 21.09 degrees Edited 2024-04-17 18:41 by OA47 |
||||
NPHighview Senior Member Joined: 02/09/2020 Location: United StatesPosts: 200 |
OA47: Very nice! Are you using openweathermap's free 1,000 calls per day service? This looks like a very nice addition to a digital clock app, now that you've worked out the bulk of the bugs :-) Live in the Future. It's Just Starting Now! |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
From the website I have this list of information: I am able to get all the static info such as: Min=Val((Json$(buff%(),"main.temp_min")))-273 Max=Val((Json$(buff%(),"main.temp_max")))-273 Prs$=Json$(buff%(),"main.pressure") Hum$=Json$(buff%(),"main.humidity") But I would like to get the string$ for but I cannot get the syntax correct. Further from the site. I have tried using "weather.main" and "weather.description" but I only get a blank. Ideas please. 0A47 Edited 2024-04-18 08:41 by OA47 |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
From some effort two and a half years ago, I have Print json$(m%(),"weather[0].description") If I recall correctly, the [0] is because of the square brackets following "weather:". PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
Thankyou very much lizby that fixed the problem for "weather.main" and "weather.description" 0A47 Edited 2024-04-18 09:38 by OA47 |
||||
OA47 Guru Joined: 11/04/2012 Location: AustraliaPosts: 926 |
NPHighwiew, Is this what you were thinking? 0A47 |
||||
NPHighview Senior Member Joined: 02/09/2020 Location: United StatesPosts: 200 |
Almost exactly! I have an analog clock, patterned after Swiss railway clock face, and will be very happy to add this to it. It picks up UTP once an hour. I think picking up weather once every 5 to 15 minutes to stay well below the 1k per day charge limit. Live in the Future. It's Just Starting Now! |
||||
Print this page |