It might. However from a mechanical standpoint it’s far beyond anything I can do, or even imagine… a 10-wheel transmission that can deliver power to any combination of 10 wheels in either direction?
Electric motors are quite torquey from 0 rpm, so I’m not sure it would be necessary… actual latency in the system will be negligible, but the rate of change IS going to be limited by the power and speed of the motor. That said, my calculations suggest the low power motor I have will be sufficient to change the string pitch in about 50ms/semitone. There is a more powerful motor that might cut that in half. I don’t know how fast you (or I) can stomp a pedal down, but it’s got to be at least 20-30 ms, so I think we are getting in the ballpark. But it remains to be seen how it will feel. I know that 10ms of latency on a keyboard is not negligible at all. However, in the case of the steel, you never get a pure square wave type change of pitch, nor do you want it. And the string itself has a response time that is limited! But also, you are continuously tracking the pedal position, so it’s not going to have latency in getting to pitch unless your foot really moves faster than the motor can.
But since you are a programmer, maybe you can help with this… I’ve uploaded the following code to the teensy, taken from a tutorial on using the L298N, and the motor is correctly responding in both directions. However, the speed control is not working. Do I need to tell the teensy that the PWM output is PWM?? Can you see other issues with this code?
int pwmPin = 17;
int motor1pin1 = 18;
int motor1pin2 = 19;
int wiperPin = 16;
int value = 0;
void setup() {
// put your setup code here, to run once:
pinMode(motor1pin1, OUTPUT);
pinMode(motor1pin2, OUTPUT);
pinMode(pwmPin, OUTPUT);
pinMode(wiperPin, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
//value = analogRead(wiperPin);
//Controlling speed (0 = off and 255 = max speed):
analogWrite(pwmPin, 4); //still seems to be full speed....
//Controlling spin direction of motors:
digitalWrite(motor1pin1, HIGH);
digitalWrite(motor1pin2, LOW);
delay(1000);
digitalWrite(motor1pin1, LOW);
digitalWrite(motor1pin2, HIGH);
delay(1000);
}
One more general teensy quesion. I’ve set the type to NO USB, because this needs to function without usb. However that means I don’t have a console to look at data… Can I safely run power to the teensy from the 298 board and via usb? When I disconnect the voltage from the 298 it doesn’t work, even with the USB connected… (EDIT: but I didn’t change the teensy to a USB interface, so maybe that’s it…)
I’m redoing my wiring more robustly, in case that is the culprit…