The SparkFun gator:rtc is a specialized real-time clock (RTC) breakout board designed for seamless integration with the micro:bit platform. This component provides accurate timekeeping and timestamp functionality, which is essential for applications that require time-sensitive operations. Common use cases include data logging with time stamps, creating clocks or timers, and managing scheduled events in educational projects or hobbyist applications.
Pin Label | Function | Description |
---|---|---|
3V3 |
Power | Connects to 3.3V power from the micro:bit |
GND |
Ground | Connects to ground on the micro:bit |
SDA |
Data | I2C data line, connects to micro:bit pin 20 |
SCL |
Clock | I2C clock line, connects to micro:bit pin 19 |
INT |
Interrupt | Optional interrupt pin, not used in basic operation |
Connecting the gator:rtc: Use alligator clips to connect the 3V3
and GND
pins on the gator:rtc to the corresponding 3.3V and GND pins on the micro:bit. Connect the SDA
and SCL
pins to pins 20 and 19 on the micro:bit, respectively.
Coding with MakeCode: Open the Microsoft MakeCode editor for micro:bit and include the gator:rtc package. Use the blocks provided by the package to set and get the time.
Using in a Circuit: When integrating the gator:rtc into a larger circuit, ensure that the I2C lines are not shared with other devices that might cause address conflicts.
Q: Can the gator:rtc be used with other microcontrollers?
Q: How long will the battery last?
Q: What is the purpose of the INT
pin?
INT
pin can be used for alarm interrupts, which are not covered in this basic documentation.For further assistance, consult the SparkFun gator:rtc datasheet or contact SparkFun support.
Below is an example code snippet for setting and reading the time on the gator:rtc using the micro:bit and MakeCode editor. This code assumes the inclusion of the gator:rtc package in the MakeCode editor.
// Initialize the gator:rtc and set the time to 12:00:00
gatorRTC.begin()
gatorRTC.setTime(12, 0, 0)
basic.forever(function () {
// Read the current time from the gator:rtc
let hours = gatorRTC.getHours()
let minutes = gatorRTC.getMinutes()
let seconds = gatorRTC.getSeconds()
// Display the current time on the micro:bit's LED matrix
basic.showString(hours + ":" + minutes + ":" + seconds)
})
Remember to wrap the code comments as needed to limit line length to 80 characters. This example provides a simple way to display the current time on the micro:bit's LED matrix.