ELEC 514 / Mbed 2 deprecated CoilingRigV16

Dependencies:   mbed mbed-rtos TextLCD

Files at this revision

API Documentation at this revision

Comitter:
thomasmorris
Date:
Mon Feb 11 14:18:58 2019 +0000
Parent:
12:d9c133b360b0
Child:
14:63998be3d43c
Commit message:
Updated;

Changed in this revision

SETUP.hpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/SETUP.hpp	Tue Feb 05 16:20:32 2019 +0000
+++ b/SETUP.hpp	Mon Feb 11 14:18:58 2019 +0000
@@ -4,13 +4,52 @@
 
 #ifndef SETUP_HPP//Header Guards Prevents Multiple includes
 #define SETUP_HPP
-
+#include "stdio.h"
+#include "string.h"
+#include "mbed.h"
+#include "rtos.h"
+#include "TextLCD.h"
+#include "iostream"
 //Libraries and header includes
 #include "rtos.h"
 
 #include "STEPPER_MOTOR.hpp"
+//Digital Outputs
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
 
-//Time definitions
+//Thread Setups
+Thread lcd_thread;
+Thread led_thread;
+TextLCD lcd(D0,D1,D4,D5,D6,D7); // rs, e, d4-d7
+Serial pc(USBTX, USBRX);         //Define serial namespace so the serial comms can be printed to
+
+
+//Switch toggling to bools for readability
+InterruptIn button_up(A0);      // UP BUTTON
+InterruptIn button_down(A1);    // These setup the button interupts
+InterruptIn button_start(A2);   // START / STOP BUTTON
+InterruptIn button_funct(A3);// Random pin  CHANGE FOR FUNCTION BUTTON
+InterruptIn button_select(A4);// Random pin CHANGE FOR SELECT BUTTON
+
+PwmOut Tendon_Power(PE_8); 
+
+//VARIABLE DEFINITIONS
+int No_Of_Rotations;
+int Function;
+bool Twist_Go;
+bool Anneal_Go;
+bool Test_Go;
+bool Select;
+
+int turns_done;
+int turns_todo;
+int Loop;
+int Wait_Time;//IN SECONDS
+
+int Duty_Cycle;
+int Power_Time;
+
 
 static STEPPER_MOTOR STEPPER_MOTOR_1(D15,D14,D13,D12);
 #endif 
\ No newline at end of file
--- a/main.cpp	Tue Feb 05 16:20:32 2019 +0000
+++ b/main.cpp	Mon Feb 11 14:18:58 2019 +0000
@@ -1,48 +1,4 @@
-#include "mbed.h"
-#include "rtos.h"
-#include "TextLCD.h"
-#include "iostream"
 #include "SETUP.hpp"
-#include "stdio.h"
-#include "string.h"
-
-//Digital Outputs
-DigitalOut led1(LED1);
-DigitalOut led2(LED2);
-
-//Thread Setups
-Thread lcd_thread;
-Thread led_thread;
-TextLCD lcd(D0,D1,D4,D5,D6,D7); // rs, e, d4-d7
-Serial pc(USBTX, USBRX);         //Define serial namespace so the serial comms can be printed to
-
-
-//Switch toggling to bools for readability
-InterruptIn button_up(A0);      // UP BUTTON
-InterruptIn button_down(A1);    // These setup the button interupts
-InterruptIn button_start(A2);   // START / STOP BUTTON
-InterruptIn button_funct(A3);// Random pin  CHANGE FOR FUNCTION BUTTON
-InterruptIn button_select(A4);// Random pin CHANGE FOR SELECT BUTTON
-
-PwmOut Tendon_Power(PE_8); 
-
-//VARIABLE DEFINITIONS
-int No_Of_Rotations;
-int Function;
-bool Twist_Go;
-bool Anneal_Go;
-bool Test_Go;
-bool Select;
-
-int turns_done;
-int turns_todo;
-int Loop;
-int Wait_Time;//IN SECONDS
-
-int Duty_Cycle;
-int Power_Time;
-
-
 //Thread Functions
 void LCD_thread(){
     while(1){
@@ -139,6 +95,7 @@
 }
 int main() 
 {
+    //Initialisation Routine
     //Interrupt setters
     button_up.rise(&up);                        //Sets up Up button
     button_down.rise(&down);                    //Sets up Down Button
@@ -166,7 +123,7 @@
     Function 1 = Anneleaing
     Function 2 = Test
     */
-    pc.printf("testing\n");
+    pc.printf("testing\n");//Outputs informtation to the putty terminal
     //Thread Starts
     lcd_thread.start(LCD_thread);
     led_thread.start(LED_thread);
@@ -174,7 +131,7 @@
     {
         if (Function == 0){       //Turning Code
             if (Twist_Go == true){
-                STEPPER_MOTOR_1.Rotate_Steps(No_Of_Rotations);
+                STEPPER_MOTOR_1.Rotate_Steps(No_Of_Rotations);//Rotates for the specified number of steps given
             }
         }else if (Function == 1){  //Annealing Code
             if (Anneal_Go == true)