|
Forum Index : Microcontroller and PC projects : Another question about ASTRO
| Author | Message | ||||
| PhilP Regular Member Joined: 25/01/2017 Location: United KingdomPosts: 41 |
Good morning. I have been following at a distance Peter's extremely clever astronomy developments. I have been trying to calculate sunrise and sunset times using various algorithms from NASA and TassyJim's previous programmes but none seem to give a sensible result. There was a simple version of the FotS but it isn't there any more. I am assuming that the maths needed to do the sunrise/sunset calculations are in some form behind the scenes in the ASTRO function. My question is could ASTRO be used to calculate sunrise and sunset times? From my reading of the function I think I would have to do iterative calculations testing date and time at a LOCATION and look for a sun elevation of zero. Thanks for any feedback Phil |
||||
| JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4321 |
Do you know what it was called on FotS? It may be on archive.org or someone may have a copy. John |
||||
| BarryH Regular Member Joined: 05/01/2025 Location: AustraliaPosts: 41 |
Quick & Dirty Daylight Indicator, perhaps https://fruitoftheshed.com/wiki/doku.php?id=mmbasic:quick_and_dirty_daylight_indicator BarryH |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11319 |
You can use the astro command to do this by iterating when the sun is at 5 degrees below the horizon |
||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3751 |
I use this Annex Basic code. If it would give you a suitable answer, you should be able to modify it for MMBasic. I asked for the "civil_twilight" value. dawndusk: aa1$="https://api.sunrise-sunset.org/json?" aa2$="lat=44.0&lng=-64.7&tzid=America/Halifax" aa$=wget$(aa1$+aa2$) dawn$="06:50:00" ' AM dusk$="17:37:00" ' PM if instr(aa$,"No Data") = 0 then dawn$=json$(aa$,"results.civil_twilight_begin") wlog "dawn: "+dawn$ dusk$=json$(aa$,"results.civil_twilight_end") dusk$=str$(val(mid$(dusk$,1,1))+12)+mid$(dusk$,2) ' 12-hour clock wlog "dusk: "+json$(aa$,"results.civil_twilight_end") endif return (wlog is print to a console) PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on FOTS |
||||
| PhilP Regular Member Joined: 25/01/2017 Location: United KingdomPosts: 41 |
Thanks everyone. @JohnS - I thought it had sunset in its title and there doesn't appear to be a title like that on FotS. However the file @BarryH pointed me at at was probably what i remembered. @Peter - I want to try the ASTRO method but I have now found the old program I remember from the Forum - attached. I have adapted it to my location and the result is within a minute of the official sunset/sunrise times. I plan to run it on a MX170 but it is needed only once a day. @lizby - thanks for the Annex code - I use them extensively for applications IoT projects monitoring parameters to upload to Thingspeak for example. I wanted the MX170 to be independent of the internet so the calculation method was the solution. Phil sunset_rise back shed original.zip |
||||
| barewires Newbie Joined: 13/04/2015 Location: United KingdomPosts: 34 |
I have been using the free BASIC programs from Sky and Telescope since the mid 80s. https://skyandtelescope.org/astronomy-resources/basic-programs-from-sky-telescope/ |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |