1
3
1
4
1
5
1
6
1
7
1
8
1
9
2
0
2
1
2
2
2
3
2
4
2
5
2
6
2
7
2
8
2
9
3
0
3
1
3
2
3
3
3
4
3
5
3
6
3
7
3
8
3
9
4
0
SerialUSB.println(
""
);
SerialUSB.println(
"--- START ---------------------------------------------
------"
);
////////////////////////////////////////
// Low-level initialize
SerialUSB.println(
"### I/O Initialize."
);
Wio.Init();
SerialUSB.println(
"### Power supply ON."
);
Wio.PowerSupplyGrove(
true
);
delay(
500
);
////////////////////////////////////////
// Device initialize
SerialUSB.println(
"### Device initialize."
);
Wire.begin();
RTC.begin();
////////////////////////////////////////
// Completed
SerialUSB.println(
"### Completed."
);
}
void
loop
()
{
uint8_t
val;
RTC.EepromRead(
0
, &val,
sizeof
(val));
SerialUSB.print(
"EEPROM value is "
);
SerialUSB.println(val);
val++;
RTC.EepromWrite(
0
, &val,
sizeof
(val));
SerialUSB.println(
"Beep."
);
pinMode(WIO_D38, OUTPUT);
digitalWrite(WIO_D38, HIGH);
delay(
200
);
digitalWrite(WIO_D38, LOW);
SerialUSB.println(
"Shutdown."
);
RTC.SetWakeupPeriod(BOOT_INTERVAL);
RTC.Shutdown();
while
(
1
) {}
}
////////////////////////////////////////////////////////////////////////////
////