hello,
the answer is: I do not know, I put them back to pin 3 and 4 and still the same. The speed does not change with the message I receive from Max/MSP (0-255).
On the H-Bridge the connections are like on here:
http://itp.nyu.edu/physcomp/Labs/DCMotorControlexcept the switch pin (deleted from code as well)
1, Funny thing: If I unplug Motor Logic Pin1 (which is digPin 4 (LOW) ) the FAN still spins with the same speed. Does it just need HIGH to work?
2, Could anyone tell me what messages a PWM FAN needs in HIGH and LOW as minimum (lowest speed) and maximum (fastest)? Do I have to change both or just one to change the speed? 5V and 12V fans I am using.
The resent code (does not change speed with the Max/MSP message):
int motor1Pin = 3; // H-bridge leg 1 (pin 2, 1A)
int motor2Pin = 4; // H-bridge leg 2 (pin 7, 2A)
int enablePin = 9; // H-bridge enable pin
int val = 0;
int speed = 0;
int high = 10;
void setup() {
Serial.begin(9600);
// set all the other pins you're using as outputs:
pinMode(motor1Pin, OUTPUT);
pinMode(motor2Pin, OUTPUT);
pinMode(enablePin, OUTPUT);
// set enablePin high so that motor can turn on:
digitalWrite(enablePin, HIGH);
}
void loop() {
// check if data has been sent from the computer
if (Serial.available()) {
// read the most recent byte (which will be from 0 to 255)
val = Serial.read();
speed = map(val, 0, 255, 0, 1000);
high = speed;
Serial.println(val);
};
digitalWrite(motor1Pin, LOW); // set leg 1 of the H-bridge low
delayMicroseconds(100);
digitalWrite(motor2Pin, HIGH); // set leg 2 of the H-bridge high
delayMicroseconds(high);
}
Thank you,
K