lkdfjlakdjsflasdkjflkjasdlxkfghskjdmfnvcm,a wejdfkjadsb cvljdgacus;b faLRFBhetg;8bdvan;/IHgtnudihdgrg;a/wlhrfp;ouitdscagjh

Dependencies:   mbed

Fork of display_nums2 by EECS 397 Lab Group

Files at this revision

API Documentation at this revision

Comitter:
billymark
Date:
Mon Apr 02 20:49:10 2018 +0000
Parent:
4:a01cf485b9d9
Commit message:
fasdjkfha;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
stepper.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r a01cf485b9d9 -r 10c020b45c1f main.cpp
--- a/main.cpp	Fri Mar 09 22:02:39 2018 +0000
+++ b/main.cpp	Mon Apr 02 20:49:10 2018 +0000
@@ -22,11 +22,14 @@
 DigitalIn jogL(UI_JOG_LEFT_BUTTON);
 DigitalIn jogR(UI_JOG_RIGHT_BUTTON);
 
+
+
 extern spi_cfg AS1107;
 
 int main(void)
 {
-    
+  jogL.mode(PullUp);
+jogR.mode(PullUp);  
 
     
     int data;
@@ -62,10 +65,11 @@
     if(data == 2){
         stp_init();
         while(1){
-            if(jogL.read()==1){
+            wait(.1);
+            if(jogL.read() == 0){
                 stp_step(STP_CW);
             }   
-            else if(jogR.read() == 1){
+            else if(jogR.read() == 0){
                 stp_step(STP_CCW);       
             }
         }
diff -r a01cf485b9d9 -r 10c020b45c1f stepper.cpp
--- a/stepper.cpp	Fri Mar 09 22:02:39 2018 +0000
+++ b/stepper.cpp	Mon Apr 02 20:49:10 2018 +0000
@@ -5,7 +5,7 @@
 #include <spi_fix.h>
 
 
-
+Serial pc2(USBTX, USBRX);
 
 spi_cfg DRV8806 = {    
     DRV8806_ID, //ID should be unique for each slave type    
@@ -27,6 +27,9 @@
         if (stp_index<3){
             stp_index+=1;
         }
+        else
+            stp_index = 0; 
+    }
     else if(direction == STP_CCW){
         if (stp_index>0){
             stp_index = stp_index-1;
@@ -35,11 +38,13 @@
         else{
             stp_index = 3;
         }
-    spi_send(DRV8806, stepper_pos[stp_index]);
+    
+    
         
             
     }
+    pc2.printf("%d \n", stepper_pos[stp_index]);
+    spi_send(DRV8806, stepper_pos[stp_index]);
     
 }
 
-}