This sketch set and arbitrary time and date, and then send through serial port every five seconds
Dependencies: Hotboards_rtcc mbed
Diff: main.cpp
- Revision:
- 1:d385e20a630f
- Parent:
- 0:b3b7ee561bba
- Child:
- 2:374bbb14bb6a
diff -r b3b7ee561bba -r d385e20a630f main.cpp
--- a/main.cpp Tue Feb 09 22:39:19 2016 +0000
+++ b/main.cpp Tue Feb 09 22:46:13 2016 +0000
@@ -14,16 +14,16 @@
#include "mbed.h"
#include "Hotboards_rtcc.h"
-/*Abrimos una instancia de puerto serial*/
+/*serial port init*/
Serial pc(USBTX,USBRX);
/*i2c instance delaration for use with the rtcc library*/
I2C device(PB_9, PB_8);
-/* lets declare and rtcc instance */
+/*lets declare and rtcc instance */
Hotboards_rtcc rtcc(device);
int main()
{
- /* i2c bus clock set to 100khz*/
+ /*i2c bus clock set to 100khz*/
device.frequency(100000);
/* init the rtcc, just enable the clock if not already enable */
rtcc.begin();
@@ -32,7 +32,7 @@
while(1)
{
- /* get the actual time and date */
+ /* get the actual time and date */
DateTime time = rtcc.now( );
/* print to serial port */
printf( "Time- %d:%d:%d Date- %d/ %d/ %d\n",time.hour( ),time.minute( ),time.second( ),time.day( ),time.month( ),time.year( ));
Hotboards RTCC