df

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
jahatch
Date:
Wed Jul 01 02:35:56 2015 +0000
Parent:
1:6a420a141411
Commit message:
dfzfd

Changed in this revision

Encoder.cpp Show annotated file Show diff for this revision Revisions of this file
Encoder.h 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/Encoder.cpp	Tue Jun 30 23:55:34 2015 +0000
+++ b/Encoder.cpp	Wed Jul 01 02:35:56 2015 +0000
@@ -11,7 +11,7 @@
 
     //format SPI for 16 bit data, low steady state clock, second edge capture with 10MHz clock
     _spi.format(16,1);
-    _spi.frequency(10000000);
+    _spi.frequency(96000000);
 }
 
 /***********************************************************
--- a/Encoder.h	Tue Jun 30 23:55:34 2015 +0000
+++ b/Encoder.h	Wed Jul 01 02:35:56 2015 +0000
@@ -17,12 +17,13 @@
     void flip();
     short int readRaw();
     // Functions
+
 private:
     SPI _spi;
     DigitalOut _cs;
     bool parity_calc(int x);
     int sign;
-    int read();
+    int read(); 
     bool parity;
     bool enc_flag;
     //zero_ang for standing position
--- a/main.cpp	Tue Jun 30 23:55:34 2015 +0000
+++ b/main.cpp	Wed Jul 01 02:35:56 2015 +0000
@@ -2,8 +2,16 @@
 #include "Encoder.h"
 int main() {
     Encoder angEncoder(p5, p6, p7, p21);
-    angEncoder.read()
-    //DigitalOut led1(LED1);
+    Serial pc(USBTX, USBRX);   
+    DigitalOut led1(LED1);  
+    led1 = 1; 
     
-    //led1 = 1;
+    //zero_ang = 1
+    angEncoder.init(0);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     angEncoder.init(0);
+    while(1){
+    int s = angEncoder.angle();
+    pc.printf("%f\n\r", s);
+    
+    }
+
     }
\ No newline at end of file