diff options
| author | Abel Tim <abel@main.home> | 2024-07-06 11:51:53 +0200 |
|---|---|---|
| committer | Abel Tim <abel@main.home> | 2024-07-06 11:51:53 +0200 |
| commit | 1e9c0466ff5af12735f3c7330e961867030c0110 (patch) | |
| tree | 8a11af38b9dcdc7b1d2da4d8f09644bd4539c45d /debug/motordriver/onemotor_softPWM | |
| parent | 989874b7bf0f480433d57418ee8cee5d383f67bc (diff) | |
| download | robotica-1e9c0466ff5af12735f3c7330e961867030c0110.tar.gz robotica-1e9c0466ff5af12735f3c7330e961867030c0110.zip | |
Motor Calibration capabilities
Diffstat (limited to 'debug/motordriver/onemotor_softPWM')
| -rw-r--r-- | debug/motordriver/onemotor_softPWM/onemotor_softPWM.ino | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/debug/motordriver/onemotor_softPWM/onemotor_softPWM.ino b/debug/motordriver/onemotor_softPWM/onemotor_softPWM.ino index b9335f3..2f57d59 100644 --- a/debug/motordriver/onemotor_softPWM/onemotor_softPWM.ino +++ b/debug/motordriver/onemotor_softPWM/onemotor_softPWM.ino @@ -7,7 +7,7 @@ int pwm2 = 4; int encoA = 5; int encoB = 6; -int speed = 1; // speed 0-1 +int speed = 1000; // speed 0-1 double sp = 0.00; double rpm = 0.00; @@ -85,7 +85,7 @@ void resetenc(){ } void move(int sped) { - sp = abs(sped)*100; + sp = abs(sped)*0.1; mcpsoftpwm(sp); digitalWrite(enB, LOW); if (sped < 0) { @@ -104,14 +104,23 @@ void loop() { move(speed); delay(1000); readenc(); + delay(1000); + + Serial.println(); - move(0); + delay(1000); resetenc(); delay(1000); readenc(); + delay(1000); - move(-speed); + Serial.println(); + + move(500); delay(1000); readenc(); + delay(1000); + + Serial.println(); } |
