Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 2:d42e168b0fa7
- Parent:
- 1:08226e87671c
- Child:
- 3:95a3a1fbc807
--- 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);
}
}