Template for working forward

Dependencies:   mbed PinDetect

Revision:
3:a14b2aa7546e
Parent:
2:ad262f2c84ca
Child:
4:d129442ea4dd
--- a/main.cpp	Sat Oct 16 08:10:02 2021 +0000
+++ b/main.cpp	Sat Oct 16 22:44:39 2021 +0000
@@ -8,6 +8,7 @@
 PinDetect pb1(SWITCH2);
 uint8 counter = 0;
 AnalogIn lightLevel(P10_0);
+Serial          pc(USBTX, USBRX);
 
 // Callback routine is interrupt activated by a debounced pb1 hit
 void pb1_hit_callback (void)
@@ -51,19 +52,32 @@
 
     // Start sampling pb inputs using interrupts
     pb1.setSampleFrequency();
+    pc.printf("tft demo\r\n");
 
 
     GUI_SetFont(GUI_FONT_8X16X2X2);
     GUI_SetTextAlign(GUI_TA_HCENTER);
-    GUI_DispStringAt("Hello World!", 160, 200);
+    GUI_DispStringAt("Hello World!", 160, 40);
     while(1) {
+        
         GUI_SetTextAlign(GUI_TA_HCENTER);
-        GUI_DispHexAt(counter, 160, 70, 2);
+        GUI_DispHexAt(counter, 160, 100, 2);
         GUI_SetTextAlign(GUI_TA_HCENTER);
-        GUI_DispDecAt(counter, 160, 130, 3);
+        GUI_DispDecAt(counter, 160, 70, 3);
+        for(int pos = 0; pos < 8; pos++) {
+            if ((counter >> pos & 0x01) == 1) {
+                GUI_SetColor(GUI_BLUE);
+            }
+            else {
+                GUI_SetColor(GUI_DARKBLUE);
+            }
+//            GUI_FillRect(208 - (16*pos), 140, 224 - (2+16 * pos), 156);
+            GUI_FillCircle(216 - (16*pos), 148, 8);
+        }
+        GUI_SetColor(GUI_WHITE);
         GUI_SetTextAlign(GUI_TA_HCENTER);
-        GUI_DispBinAt(counter++, 160, 100, 8);
-        GUI_DispStringAt("Light is: ", 10, 160);
+        GUI_DispBinAt(counter++, 160, 160, 8);
+        GUI_DispStringAt("Light is: ", 40, 200);
         GUI_DispDec(readLightLevel(), 3);
         GUI_DispString("%");
         ThisThread::sleep_for(500);