Calculate the Lunar Eclipses for a given Year
Arduino is a powerful tool for programming and interfacing with hardware. But, it is also a powerful programmable computer with a built in ability to use your computer keyboard and display as input and output. Let's take advantage of this by writing a program that calculates the lunar eclipses for a given year. This program will cover how to input data into Arduino using the Serial Monitor, how to perform the computations, and how to return the information to the user using the Serial Monitor.
A lunar eclipse happens when the earth is between the sun and moon and the moon moves into the shadow cast into space by the earth. The program calculates the dates of the full moons and checks to see if the moon is in the correct place at these times to move into the Earth's shadow. It then reports all of the occurrences and the magnitudes of umbra and penumbra eclipsing. |
Download the code here:

moon_eclipse.ino |
Download the code and load it into the Arduino IDE. Select the correct board and download the program. Open the Serial Monitor and select 'NEWLINE' in the lower right dropdown box. Enter the year as a 4 digit value. The program will calculate the eclipsess, and display them.