Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Hexi_KW40Z Hexi_OLED_SSD1351
Fork of Hexi_BLE_Time by
Revision 6:ae8a23b0735b, committed 2018-06-09
- Comitter:
- astamb
- Date:
- Sat Jun 09 18:47:06 2018 +0000
- Parent:
- 5:0076f669169f
- Child:
- 7:88af507a85bd
- Child:
- 9:c8e4e6d4cdd0
- Commit message:
- green LED = time received!
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Jun 09 16:56:45 2018 +0000
+++ b/main.cpp Sat Jun 09 18:47:06 2018 +0000
@@ -84,6 +84,15 @@
data[19] = 0;
pc.printf("%s\n\r", data);
+ if (data) {
+ blueLed = LED_OFF;
+ greenLed = LED_ON;
+ wait_ms(1000);
+ greenLed = LED_OFF;
+ blueLed = LED_ON;
+ }
+
+ /*
// data (our command) must 20 bytes long.
// CMD for turning on: 'ledonledonledonledon'
if (data[4] == 'n') {
@@ -99,6 +108,7 @@
blueLed = LED_OFF;
pc.printf("off\n\r", data);
}
+ */
}
/***********************End of Call Back Functions*****************************/
@@ -155,27 +165,33 @@
blueLed = status;
pc.printf("[%i] blueLed = %i\r\n",counter, status);
- time_t seconds = time(&seconds);
- const tm *t = localtime(&seconds); // Convert the unix time to actual time
- /*
+ time_t rawtime;
+ struct tm * timeinfo;
+ time(&rawtime);
+ timeinfo = localtime (&rawtime);
+ const tm *t = localtime(&rawtime); // Convert the unix time to actual time
+
int h = (t->tm_hour); // The hours
int year = (t->tm_year);
// Format the time
sprintf(time_text,"%d:%d:%d",h, t->tm_min, t->tm_sec);
sprintf(date_text,"%d-%d-%d",year, (t->tm_mon), (t->tm_mday));
- */
+
char buf[80];
- struct tm ts;
- // Format time, "ddd yyyy-mm-dd hh:mm:ss zzz"
- ts = *localtime(&seconds);
- strftime(buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", &ts);
- printf("%s\r\n", buf);
+
+ // Format time, "ddd yyyy-mm-dd hh:mm:ss zzz"
+ // ts = *localtime(&rawtime);
+ // pc.printf ("Current local time and date: %s", asctime(timeinfo));
+ // strftime(buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", &ts);
+ // pc.printf("%s\r\n", buf);
+ /*
pc.printf(time_text);
pc.printf("\r\n");
pc.printf(date_text);
pc.printf("\r\n");
+ */
// Display the time on screen
// oled_status_t SSD1351::TextBox(const uint8_t* text, int8_t xCrd, int8_t yCrd,uint8_t width,uint8_t height)
