2015-01-19 01:45:17 +01:00
|
|
|
|
|
|
|
-- ESP-01 GPIO Mapping
|
|
|
|
gpio0, gpio2 = 3, 4
|
2017-03-31 20:31:35 +02:00
|
|
|
i2c.setup(gpio0, gpio2, scl, i2c.SLOW) -- call i2c.setup() only once
|
2015-01-19 01:45:17 +01:00
|
|
|
|
2017-03-31 20:31:35 +02:00
|
|
|
require("ds3231")
|
2015-01-19 01:45:17 +01:00
|
|
|
|
|
|
|
second, minute, hour, day, date, month, year = ds3231.getTime();
|
|
|
|
|
|
|
|
-- Get current time
|
|
|
|
print(string.format("Time & Date: %s:%s:%s %s/%s/%s", hour, minute, second, date, month, year))
|
|
|
|
|
|
|
|
-- Don't forget to release it after use
|
|
|
|
ds3231 = nil
|
|
|
|
package.loaded["ds3231"]=nil
|