Hi, using the following code, from "0-255", it does increase speed the higher the value, but at value of "0" it still moves the AC servo "5" RPM.
int ledPin = 5; // LED connected to digital pin 5
int val = 0; // variable to store the read value
void setup() {
pinMode(ledPin, OUTPUT); // sets the pin as output
}
void loop() {
analogWrite(ledPin, 0); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
}
the drive takes analog of 0-10V, arduino has 0-5v, so was thinking whatever ill test with 5v yayks... is that why it doesnt stop completely at "0". Well i ask because a 0 is a 0 weather in 0-10v or in 0-5v.
Last time I looked, that is exactly what analogWrite does
Edit: Back at a PC now. Yup:
void analogWrite(uint8_t pin, int val)
{
// We need to make sure the PWM output is enabled for those pins
// that support it, as we turn it off when digitally reading or
// writing with them. Also, make sure the pin is in output mode
// for consistenty with Wiring, which doesn't require a pinMode
// call for the analog output pins.
pinMode(pin, OUTPUT);
if (val == 0)
{
digitalWrite(pin, LOW);
}
else if (val == 255)
{
digitalWrite(pin, HIGH);
}
else
No, Uno has no analog outputs. It has only PWM outputs, which switch between 0V and 5V with a frequency of ~500Hz or ~1000Hz. analogWrite() sets the "duty cycle" which is the % of time in each cycle that the signal is 5V.
What happens if you connect the AC servo input to 0V?
Do you have a common ground between the Arduino and the servo?
how can i add a line of code saying, if volt = 0, then cutoff pin 5 completely!
int ledPin = 5; // LED connected to digital pin 5
int val = 0; // variable to store the read value
void setup() {
pinMode(ledPin, OUTPUT); // sets the pin as output
}
void loop() {
analogWrite(ledPin, 0); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
}