Hi,
In this tutorial, you will learn how to access a DS1307 RTC module using the Windows IoT and the Intel Galileo Gen1 platform.
Pre-requisit:
- Intel Galileo Gen 1 hardware
- Visual Studio 2013 with Windows IoT plugin
- A git tool to get access to the source code repository
- A DS1307 module (from adafruit)
Hardware wiring:
The DS1307 module should be wired as following, please note that the LED is just here to show some system activity and can be removed.
|
Intel Galileo Gen1 and DS1307 module wiring |
Software:
The RTClib included inside this project is inherited from
https://github.com/jcw/rtclib, and minor adaptations has been added in order to make it working in the Windows IoT environment.
Setup function
The setup function is in charge of the initialization of the platform and is a good place for the I2C/TwoWire library initialization.
The next step is the initialisation of the RTC to a specific time (August 22nd 2014 at 12:00:59).
// Set a default time
rtc.adjust(DateTime(2014, 8, 22, 12, 00, 59));
loop function
The loop function is making the LED blinking witch have not a big interest here, but it also reading the time and display it in the Visual Studio output window.
// Get time from the RTC
dt = rtc.now();
sprintf_s(outputBuffer, "%d:%02d:%02d\n", dt.hour(), dt.minute(), dt.second());
OutputDebugStringA(outputBuffer);
Conclusion:
The access to the RTC using an existing Arduino sketch is really straightforward on the Windows IoT platform, and the whole development took 30 mins.
|
Intel Galileo Gen1 with DS1307 module |
-Nicolas