ECE 111 At Oregon State University / Mbed 2 deprecated Lab6_Basic

Dependencies:   mbed

Fork of Lab6_Basic by ECE 111 At Oregon State University

Revision:
6:65dfd3886629
Parent:
4:b3a93554fedf
Child:
7:33a516c08c09
diff -r 56bbef4099da -r 65dfd3886629 main.cpp
--- a/main.cpp	Fri Nov 18 03:59:01 2016 +0000
+++ b/main.cpp	Tue Nov 14 13:02:54 2017 -0800
@@ -9,37 +9,39 @@
 /*  Description:              */
 /*                                                                                      */
 /****************************************************************************************/
+// Edit ~ Matthew Sessions
 
-Servo my_servo(PTB3,PTE19,PTE18,PTE31);
-AnalogIn Spanel(PTB2);
+// KL46
+// Servo my_servo(PTB3,PTE19,PTE18,PTE31);
+// KL43
+Servo my_servo(PTB3,PTB0,PTB1,PTE29);
+AnalogIn solar_panel(PTB2);
+
 uint16_t reading_array[3];
 int position_array[3]={30,75,120};
 uint16_t largest = 0; 
 int largesti = 0;
 int i;
 
-int main() {
-
-while (1) {  
-
-for (i = 0; i < 3; i++){
-my_servo.set(position_array[i]);
-wait(3);
-reading_array[i] = Spanel.read_u16();
-}
-
-
-
-
-
-for (i = 0; i < 3; i++){
-    if (reading_array[i] > largest){
-        largest = reading_array[i];
-        largesti = i;
-        
+int main() 
+{
+    while (1) 
+    {  
+        for (i = 0; i < 3; i++)
+        {
+            my_servo.set(position_array[i]);
+            wait(3);
+            reading_array[i] = solar_panel.read_u16();
         }
-    }
-my_servo.set(position_array[largesti]);
-wait(15);
+        for (i = 0; i < 3; i++)
+        {
+            if (reading_array[i] > largest)
+            {
+                largest = reading_array[i];
+                largesti = i;
+            }
+        }
+        my_servo.set(position_array[largesti]);
+        wait(15);
     }
 }