Hi,
Anyone with a annex code for this?
Sunrise and sunset...
-
- Posts: 222
- Joined: Mon Feb 15, 2021 1:44 pm
- Has thanked: 123 times
- Been thanked: 132 times
Re: Sunrise and sunset...
Probably the simplest way is to use the API at https://sunrise-sunset.org/api .
Also, the OpenWeatherMap API will give you sunrise and sunset for a location along with weather information.
If you want to do this by purely mathematical means without web access then there is a discussion thread here :
https://picaxeforum.co.uk/threads/sunri ... 8m2.30114/
(Hint - It's extremely complex.)
Cicciocb, I hope you don't mind a link to an alternative microcontroller forum. Please delete if you do.
Picaxe has it's uses but ESP8266 / ESP32 has WIFI
Also, the OpenWeatherMap API will give you sunrise and sunset for a location along with weather information.
If you want to do this by purely mathematical means without web access then there is a discussion thread here :
https://picaxeforum.co.uk/threads/sunri ... 8m2.30114/
(Hint - It's extremely complex.)
Cicciocb, I hope you don't mind a link to an alternative microcontroller forum. Please delete if you do.
Picaxe has it's uses but ESP8266 / ESP32 has WIFI
- Fernando Perez
- Posts: 378
- Joined: Mon Feb 15, 2021 10:09 pm
- Location: Santander (Spain)
- Has thanked: 195 times
- Been thanked: 267 times
Re: Sunrise and sunset...
Panno, this was already covered in the old forum:
https://groups.google.com/g/annex_wifi_ ... KUZG3EAwAJ
As AndyGadget says, I think the system that pointed fu-ma ... @ berlin.de is the most suitable.
And the one suggested by Electroguard, the simplest.
I provide you with a simple code that can help you. You must take into account that you have to add the hours of difference of your place, in my case two.
This only returns data for the current day, but you will see that it is easy to interrogate the API with future days on the original site:
https://sunrise-sunset.org/api
https://groups.google.com/g/annex_wifi_ ... KUZG3EAwAJ
As AndyGadget says, I think the system that pointed fu-ma ... @ berlin.de is the most suitable.
And the one suggested by Electroguard, the simplest.
I provide you with a simple code that can help you. You must take into account that you have to add the hours of difference of your place, in my case two.
Code: [Local Link Removed for Guests]
' In memory of M.R. James
lat$ = "43.0275"
lng$ = "0.570833"
r$ = wget$("api.sunrise-sunset.org/json?lat="+lat$+"&lng="+lng$, 80)
' wlog r$
sunrise$ = json$(r$,"sunrise")
sunset$ = json$(r$,"sunset")
wlog "sunrise at "; sunrise$
wlog "sunset at "; sunset$
https://sunrise-sunset.org/api