The code for Lab 5

Dependencies:   TSI

Fork of TSI_sample by William Marsh

Files at this revision

API Documentation at this revision

Comitter:
Tobden
Date:
Mon Mar 05 13:53:45 2018 +0000
Parent:
5:fb3b23290880
Commit message:
TSI Lab5 code

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r fb3b23290880 -r 968bd77025bb main.cpp
--- a/main.cpp	Fri Mar 02 23:39:52 2018 +0000
+++ b/main.cpp	Mon Mar 05 13:53:45 2018 +0000
@@ -98,36 +98,37 @@
         pc.putc(' ') ;
         switch (area)
         {
+         
 case LeftOut:
 
-         if (numb == 0)
+         if (d>0)
 
                  redLED =  redLED;
-            if (d<3 || d>9)
+        else    if (d<3 || d>9)
                     {numb = 1;
                      area = None;
                       break;
               }
 case LeftIn:
-          if (numb == 0)
+          if (d>0)
                 greenLED = greenLED;
-                     if (d<13 || d > 19){
+               else      if (d<13 || d > 19){
                             numb = 1;
                             area = None;
                              break;
         }
  case RightIn:
-        if (numb == 0)
+        if (d>0)
                 blueLED = blueLED;
-                    if (d< 23 || d > 29){
+                  else  if (d< 23 || d > 29){
                           numb = 1;
                             area = None;
                             break;
         }
 case RightOut:
-        if (numb == 0)
+        if (d>0)
             led1 = led1;
-                    if (d<33)
+            else        if (d<33)
                          {numb = 1;
                           area = None;
                              break;