Task 4.4.2

Fork of Task442 by Nicholas Outram

Revision:
2:5914bea4068e
Parent:
0:44a74c1bc812
Child:
3:22fb972026c5
diff -r b0f53d2975bd -r 5914bea4068e main.cpp
--- a/main.cpp	Thu Jul 13 14:55:06 2017 +0000
+++ b/main.cpp	Tue Feb 13 11:49:20 2018 +0000
@@ -27,7 +27,11 @@
 
         //Sleep
         sleep();
-
+        
+        //READ ADC as an unsigned integer.
+        //Shift right 4 bits (this is a 12bit ADC) & store in static global variable
+        sample16 = POT_ADC_In.read_u16() >> 4;
+        
         //Displauy the sample in HEX
         pc.printf("ADC Value: %X\n", sample16);
  
@@ -39,9 +43,5 @@
 {
     //Toggle on board led
     led = !led;
-
-    //READ ADC as an unsigned integer.
-    //Shift right 4 bits (this is a 12bit ADC) & store in static global variable
-    sample16 = POT_ADC_In.read_u16() >> 4;
 }