Coursework

Revision:
22:82b01fdfc61f
Parent:
21:2e37f80e8b5b
Child:
23:f72175fb49ed
diff -r 2e37f80e8b5b -r 82b01fdfc61f main.cpp
--- a/main.cpp	Tue Jan 18 21:01:54 2022 +0000
+++ b/main.cpp	Tue Jan 18 23:12:23 2022 +0000
@@ -5,6 +5,7 @@
 #include "Piezo.h"
 #include "string"
 #include "array"
+#include <iostream>
 // FSM Menu 
 // defines directions as 0/1. Note UPPERCASE
 #define UP 0
@@ -171,9 +172,31 @@
    Object1.namestruct = "name";
  
     while(1) {
-        
+        // section to try to get POC of number comparitor without using the US for repeatablity// to get if statements correct possibly change to switch 
+        int num1;
+        int num2;
+        int num3;
+        int num4;
+        cout << "Test value collection";
+        cin >> num1;
+        cin >> num2;
+        cin >> num3;
+        cin >> num4;
+        cout << num1;
+        if (num1 >num2){
+            cout <<'x';
+            }else {
+            cout <<'-';}
+            if (num2 >num3){
+            cout <<'x';
+            }else {
+            cout <<'-';}
+            if (num3 >num4){
+            cout <<'x';
+            }else {
+            cout <<'-';}
         
-        
+        /////////////////////////////////////////////////////////////////
         switch(PressA){
      default:
      lcd.clear();     
@@ -186,6 +209,7 @@
      wait_ms(50);
      
      break;
+//////////////////////////////////////////////////////////////////////////////////////////////////     
      case 1:
      PressA =1;
       lcd.clear();    
@@ -197,16 +221,19 @@
     }
     wait_ms(50); // required to stop Black screen issue
         break;
-        
+////////////////////////////////////////////////////////////////////////////        
      case 2: 
     PressA= 2;
-                 // firstScan[1] = sensor.distance(); 
- //     printf("Distance :  %d cm",firstScan[x]);
-    lcd.clear();
-       lcd.printString("Menu 2",0,0);        
-         lcd.refresh();
-         wait_ms(50); // required to stop Black screen issue
+    long secondScan[10];
+    
+                 secondScan[5] = sensor.distance();
+ printf("Distance :  %d cm", secondScan[5]);
+ lcd.clear();
+       lcd.printString("2nd Scan up down",0,0); 
+       lcd.drawLine(0,10,80,10,2);  
      break;
+     
+////////////////////////////////////////////////////////////////////     
      case 3:
               PressA= 3;
          lcd.clear();