Hi,I am in the process of building a motorized robot. To do so I bought a motorized toy from a local thrift shop. It has two motors which run the wheels. I first thought I'd have to get a motor shield to control the motors. However, when I disassembled it I found it had motor controller circuitry and each of the two motors can be rotated forward and back by simply applying power to the board and then applying a signal to one of four input wires from the radio control module (which I removed). So this means I can control the fwd, back, left, right movement of the toy by simply setting the state of these four control inputs. Sounds good right? The problem is that the speed this toy goes is way to fast for my purposes. I need to slow it down a bit. However, there's no speed control, it's either on or off. My thought was that by modulating the signal to these control inputs I can control the motor speed. So instead of a constant "high" signal to the FWD control line I could send it a square wave. The size of the peaks in the square wave would control the speed, i.e. wider peaks = faster speed. This comes to my question. What would the code look like on the Arduino to send a signal like this out of one of the digital (or analog) outputs? I suppose I could do some sort of looping code where a delay is adjusted shorter or longer to control the on time for the square wave. However, this sounds a little strange to me and I was wondering if there is a function within a servo library or something similar I could use for this. Hope this isn't too confusing. Thanks in advance for reading!Alex
Basically, just use PWM control via analogWrite() - note that only certain digital i/o pins can be controlled via analogWrite() - so review the Ardunio docs...
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16