74 SERVO 12.2014
servos. The servos would just wave around some “arms.”
What we really wanted to control was the DC motor.
As a quick proof of concept, we took the Arduino
module out of the equation so that the motor and servos
were just connected straight to the button. Just as we had
hoped, when the button was released, the servos, motor,
and buzzer came to life. So, why bother with the Arduino
module? If we were to implement the circuit in the robot
as-is, our present defender would indeed move when the
present sitting atop the pressure plate was moved. The
problem was that it would only move forward at one
speed.
We wanted slightly more sophisticated movement back
and forth, so the bot wouldn’t try to outrun its tether. We
also wanted the option to exercise more granular control if
we implemented a second motor in the drive train to
increase maneuverability. We wanted to achieve more than
the robotic equivalent of a unidirectional domino show.
The Arduino Code
The way to achieve more was through programming
with the Arduino module. As we mentioned last month, the
Arduino board is equipped with three inputs (two analog
and a digital) and three outputs (three digital). For those
hoping for some motor control, three digital outputs may
sound like a disappointment. Once again, however, we
were impressed by the efficient design on display with the
littleBits.
Two of the output ports are paired with output
switches — much like the unassuming mode switches on the
servo and motor modules. The output mode switch allows
you to switch the digital output to analog output or PWM
output. You still have only three outputs, but with up to two
PWM outputs you should be well on your way to robotic
greatness. We actually prefer the switchable ports instead of
having more ports coming off of the Arduino module.
Sure, the Arduino module could have its three digital
outputs, and it could even have separate ports for PWM
output. Or, for analog output for that matter. However,
since each port would be outfitted with a magnetic littleBits
connector, the module would become bulky and unwieldy
with even just a few more ports. We prefer the compact
simplicity with the three inputs and three outputs, and we
think the output mode switch is a clever way to efficiently
use circuit board real estate.
The littleBits website has a few resources that introduce
UPLOADING.
ROBOT INNARDS.
SKETCHING OUT A PROGRAM.