Show Posts
|
|
Pages: [1]
|
|
1
|
Using Arduino / Programming Questions / Re: analogWrite(pin, 0) ouputs 0.104V?
|
on: May 20, 2012, 03:17:37 am
|
|
I use the connection in attachment but without variac. Other thing I noticed is if I use analogWrite(pin, 255) the motor is not fully ON (compared to speed achieved by linking gate of IRFZ via resistor in picture directly to +5V)?! I call MowerSpeed(255); or with 0.
const int Mower = 12;
void MowerSpeed (unsigned char MowerSpeed) { //0-255 0=off 255=full on if ((SoftStart == (SoftBOTH - 1)) || (MowerSpeed > 127)) { for (unsigned char a = 0; a < MowerSpeed; a++) { analogWrite(Mower, a); delay(10); } SoftStart = 0; } analogWrite(Mower, MowerSpeed); }
Tnx in advance.
|
|
|
|
|
2
|
Using Arduino / Programming Questions / Re: analogWrite(pin, 0) ouputs 0.104V?
|
on: May 16, 2012, 03:35:30 pm
|
|
The pin is PCI28/OC1B/(Digital 12)/PD4/pin18 on ATMEL ATMEGA644P/SANGUINO. So: pin=12.
I checked wiring.h and wiring_analog.c for sanguino and everything is OK. Translates to: sbi(TCCR1A, COM1B1); // connect pwm to pin on timer 1, channel B OCR1B = val; // set pwm duty
PWM works great at >0.
|
|
|
|
|
4
|
Using Arduino / Programming Questions / analogWrite(pin, 0) ouputs 0.104V?
|
on: May 16, 2012, 02:42:42 pm
|
|
Hi, I am trying to drive a motor via PWM, but when I want to turn it off using analogWrite(pin, 0), I can stil hear hum from the motor. If I measure voltage on the PWM pin (nothing attached on it i.e. only uC pin) it reads 0.104V. It makes no change if I set the pin as output or not. How to solve it?
If this problem cannot be overcome, how to exchange analogWrite and digitalWrite? The following does not work: pinMode(pin, OUTPUT); //=in Setup. Not needed for analogWrite if (Speed == 0) { analogWrite(pin, 0); digitalWrite(pin, 0); } else { //digitalWrite(pin, 1); ?!?!?!? what to do here? analogWrite(pin, Speed); }
|
|
|
|
|