L6230

Dependencies:   L6230_BLDC mbed reScale

Revision:
2:d42e168b0fa7
Parent:
1:08226e87671c
Child:
3:95a3a1fbc807
diff -r 08226e87671c -r d42e168b0fa7 main.cpp
--- a/main.cpp	Thu Jun 25 17:41:11 2020 +0000
+++ b/main.cpp	Thu Jun 25 17:44:28 2020 +0000
@@ -16,14 +16,14 @@
 
 Serial pc(USBTX, USBRX);
 
-reScale _scale(0, 1, 800, 5000); 
+reScale _scale(0, 4095, 800, 5000); 
 
 float read_current(char);
 
 int prevStep;
 
-float speed;
-float adc;
+long speed;
+long adc;
 
 int main() 
 {
@@ -33,8 +33,9 @@
     
     while(1) 
     {
-            adc = pot.read();
-            speed =_scale.from(adc);  
+            adc = pot.read() * 4096;
+            speed =_scale.from(adc);
+            //pc.printf("%i\r",speed);  
             motor.one_step(1, speed, &prevStep);
     }
 }