Skip to content

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

License

Notifications You must be signed in to change notification settings

achill-es/moonPhase-esp32

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codacy Badge

moonPhase

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

Usage

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

Functions:

  • moonPhase getPhase() Get the current moon phase. (First set freeRTOS system time)

  • moonPhase getPhase( time_t t ) Get the moon phase 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:

}

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 100.0%