Controller accessories for video game consoles like
Nintendo’s “Power Glove” use ex-sensing technology. It
was the rst video game controller attempting to mimic
hand movement on a screen in real time.
Circuit 2
Arduino Code:
9
Troubleshooting:
Servo Not Twisting
Even with colored wires it is still shockingly easy to plug a
servo in backwards. is might be the case.
Servo Not Moving as Expected
e sensor is only designed to work in one direction. Try
exing it the other way (where the striped side faces
out on a convex curve).
Servo Doesn’t Move very Far
You need to modify the range of values in the call to the
map() function.
You should see the servo motor move in
accordance with how much you are
exing the ex sensor. If it isn't
working, make sure you have assembled
the circuit correctly and veried and
uploaded the code to your board or see
the troubleshooting tips below.
Code to Note:
Real World Application:
Open Arduino IDE // File > Examples > SIK Guide > Circuit # 9
What You Should See:
IOREF
RESET
RESET
7-15V
SCL
SDA
AREF
GND
13
12
~11
~10
~9
8
7
~6
~5
4
~3
2
1
0
TX
RX
13
3.3V
5V
GND
GND
VIN
A0
A1
A2
A3
A4
A5
POWER
ANALOG IN
DIGITAL (PWM~)
ON
ISP
TX
RX
IOREF
RESET
RESET
7-15V
SCL
SDA
AREF
GND
13
12
~11
~10
~9
8
7
~6
~5
4
~3
2
1
0
TX
RX
13
3.3V
5V
GND
GND
VIN
A0
A1
A2
A3
A4
A5
POWER
ANALOG IN
DIGITAL (PWM~)
ON
ISP
TX
RX
Because the ex sensor / resistor combination won't give us a
full 0 to 5 volt range, we're using the map() function as a
handy way to reduce that range. Here we've told it to only
expect values from 600 to 900, rather than 0 to 1023.
servoposition = map(flexposition, 600, 900, 0, 180);
Because map() could still return numbers outside the "to"
range, we'll also use a function called constrain() that will
"clip" numbers into a range. If the number is outside the
range, it will make it the largest or smallest number. If it is
within the range, it will stay the same.
servoposition = constrain(servoposition, 0, 180);
map(value, fromLow, fromHigh, toLow, toHigh)
constrain(x, a, b)
Page 56