GithubHelp home page GithubHelp logo

celliesprojects / moonphase-esp32 Goto Github PK

View Code? Open in Web Editor NEW
18.0 2.0 6.0 211 KB

An ESP32 library to get the moon phase angle and visible percentage of the moon that is illuminated.

License: MIT License

C++ 100.00%
moon-phase moon-phase-angle arduino-ide moon esp32-arduino lunar-phase

moonphase-esp32's Introduction

moonPhase

A library for esp32 to get the moon phase angle and percentage of the moon that is illuminated. (as seen from Earth)
Preferred methods to install is to use the Arduino IDE library manager.

For esp8266 non-os or avr (Arduino) you can use the steve-sienk fork.

Manual install

  1. Download the latest release and unpack in the Arduino libraries folder.
  2. Restart the Arduino IDE.

Functions

  • getPhase() Get the current moon phase. (First set freeRTOS system time - see the esp32-sntp example)

  • getPhase( time_t t ) Get the moon phase as it was at time t.

Example code

#include <moonPhase.h>

moonPhase moonPhase;                       // include a MoonPhase instance

void setup() {
  Serial.begin(115200);
  Serial.println();
  Serial.println( "moonPhase simple example." );

  moonData_t moon;                        // variable to receive the data

  moon = moonPhase.getPhase();            // gets the current moon phase ( 1/1/1970 at 00:00:00 UTC )

  Serial.print( "Moon phase angle: " );
  Serial.print( moon.angle );             // angle is a integer between 0-360
  Serial.println( " degrees." );
  Serial.print( "Moon surface lit: " );
  Serial.print( moon.percentLit * 100 );  // percentLit is a real between 0-1
}

void loop() {
  // put your main code here, to run repeatedly:

}

moonphase-esp32's People

Contributors

celliesprojects avatar per1234 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

moonphase-esp32's Issues

Document MoonPhase.cpp

I have no reason to doubt the correctness of MoonPhase.cpp. However, if you're not intimately familiar with the scientific foundation of the formulas you have no way of verifying the correctness. Two things would help greatly:

  • those single-char variables should be renamed to something more expressive
  • document the constants, ideally with references

need help for using this lib on a ESP8266

Hello Cellie,
Love to use your excellent lib on a ESP8266, but have little experience in how to change the code to get it running on the older ESP8266. Could you point me in the right direction?

Moonphase

Hello

Is the moonphase everywhere the same on earth?
Location does not matter?

Would be nice on my thermostat
Http://www.Arduino.TK

Greet luberth

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.