File tree Expand file tree Collapse file tree 1 file changed +28
-2
lines changed
Expand file tree Collapse file tree 1 file changed +28
-2
lines changed Original file line number Diff line number Diff line change 22
33An ESP32 library to get the moon phase angle and percentage of the moon that is illuminated.
44
5- ## Usage:
5+ #### Usage:
66
771 . Download the latest release and unpack in the esp32 ` libraries ` folder.
882 . Restart the Arduino IDE.
99
10- Some examples are included.
10+ #### Example code:
11+ ```` c++
12+ #include < moonPhase.h>
13+
14+ moonPhase moonPhase; // include a MoonPhase instance
15+
16+ void setup () {
17+ Serial.begin(115200);
18+ Serial.println();
19+ Serial.println( "moonPhase simple example." );
20+
21+ moonData_t moon; // variable to receive the data
22+
23+ moon = moonPhase.getPhase(); // gets the current moon phase ( 1/1/1970 at 00:00:00 UTC )
24+
25+ Serial.print( "Moon phase angle: " );
26+ Serial.print( moon.angle ); // angle is a integer between 0-360
27+ Serial.println( " degrees." );
28+ Serial.print( "Moon surface lit: " );
29+ Serial.print( moon.percentLit * 100 ); // percentLit is a real between 0-1
30+ }
31+
32+ void loop () {
33+ // put your main code here, to run repeatedly:
34+
35+ }
36+ ````
You can’t perform that action at this time.
0 commit comments