28 lines
445 B
Arduino
Raw Normal View History

2013-02-05 19:01:35 +01:00
// CenterAB - both motors
// CenterA at xB, CenterB at xA?
// feels like "Slave"
#include <Motor.h>
#include <Music.h>
int duty, count, fout;
int xA, xB, foutA, foutB;
void setup(){
MotorA.init();
MotorB.init();
2013-02-09 21:38:08 +01:00
Music.init();
2013-02-05 19:01:35 +01:00
}
void loop(){
xA = analogRead(A0);
xB = analogRead(A3);
2013-02-09 21:38:08 +01:00
foutA = 2*(xB-xA);
MotorA.torque(foutA);
foutB = 2*(xA-xB); // this will peak at x=1024/6
2013-02-05 19:01:35 +01:00
MotorB.torque(foutB); // 1/4 or 1/2 ?
}