Getting Synched

First time after a lot of tries. -Bill
This commit is contained in:
Bill Verplank
2012-12-07 08:15:45 -08:00
parent 0a0e857cea
commit 4c9e2ee748
23 changed files with 1849 additions and 439 deletions
+26
View File
@@ -0,0 +1,26 @@
#include <Motor.h>
float pos, fin, finmax, fout;
byte c; // used as a counter from 0 to 255
int duty;
void setup(){
digitalWrite(A4,HIGH);
digitalWrite(A5,LOW);
pinMode(A4, INPUT);
pinMode(A5, OUTPUT);
//MotorB._period(32);
}
void loop(){
fin += .01*(analogRead(A4)-fin);
fout = 0.5*fin*(1024+random(1024));
duty = min(1024,fout);
duty = abs(duty);
//duty = min(duty,1024);
MotorB.torque(duty);
if(fout<0)MotorB.direction(FORWARD);
else MotorB.direction(BACKWARD);
}