Nrithya Theetharappan / Mbed OS Hexi_BLE_Time_copy

Dependencies:   Hexi_KW40Z Hexi_OLED_SSD1351

Fork of Hexi_BLE_Time by Adam S

Files at this revision

API Documentation at this revision

Comitter:
nrithya
Date:
Mon Jun 11 02:02:58 2018 +0000
Parent:
7:88af507a85bd
Commit message:
display to screen

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Jun 10 13:04:58 2018 +0000
+++ b/main.cpp	Mon Jun 11 02:02:58 2018 +0000
@@ -105,6 +105,46 @@
         //printf("%ld\n",long(timeinfo));
         //printf("Time as a string = %s", ctime(&timeinfo));
         sprintf(buffer,"%s",ctime(&timeinfo));
+        sprintf(text,"%s","   ");
+        //char str[]="sun jun 10 12:34:33 2018";
+        //printf("%s\n", str);
+        oled.TextBox((uint8_t *)text,1,40,55,15); 
+        oled.FillScreen(COLOR_BLACK);
+    
+        char *token[10];
+        token[0] = strtok(buffer, " ");
+    
+    // Keep printing tokens while one of the
+    // delimiters present in str[].
+        int i=0;
+    while (token[i] != NULL)
+    {
+        printf("%s\n", token[i]);
+        i++;
+        token[i] = strtok(NULL, " ");
+    }
+    char str1[60];
+    char str2[10];
+    //char str[80];
+    /*strcpy (str1,token[0]);
+    strcat (str1,token[1]);
+    strcat (str1,token[2]);
+    strcat (str1,token[4]);*/
+    sprintf(str1,"%s %s %s %s",token[0],token[1],token[2],token[4]);
+    strcpy(str2,token[3]);
+    printf("%s\n %s\n",str1,str2);
+    oled.Label((uint8_t *)str1,1,40);
+    oled.Label((uint8_t *)str2,1,60);
+    /*for(int i=0;i<10;i++){
+        //oled.Label((uint8_t *)str[i],1,40+i);
+        sprintf(str1,"%s",str[i]);
+        printf("%s\n",str1);
+        }
+        printf("%s\n",str1);*/
+        //printf("%s\n", str);
+        
+        
+        
         printf("%s",buffer);
         for(int i=0;i<10;i++)
         {
@@ -169,7 +209,7 @@
     oled.SetTextProperties(&textProperties);
     
     /* Display Bluetooth Label at x=17,y=65 */ 
-    strcpy((char *) text,"BLUETOOTH");
+    //strcpy((char *) text,"BLUETOOTH");
     //oled.Label((uint8_t *)text,17,65);
     
     /* Change font color to white */ 
@@ -178,7 +218,7 @@
     oled.SetTextProperties(&textProperties);*/
     
     /* Display Label at x=22,y=80 */ 
-    strcpy((char *) text,"Tap Below");
+    //strcpy((char *) text,"Tap Below");
     //oled.Label((uint8_t *)text,22,80);
 
     // txThread.start(txTask); /*Start transmitting Sensor Tag Data */
@@ -223,8 +263,8 @@
         
         // 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)*/
-        oled.TextBox((uint8_t *)time_text,2,2, 91, 15); 
-        oled.TextBox((uint8_t *)date_text,2,16, 91, 15); 
+        //oled.TextBox((uint8_t *)time_text,2,2, 91, 15); 
+        //oled.TextBox((uint8_t *)date_text,2,16, 91, 15); 
         redLed = !redLed;
         
         Thread::wait(500);