The program that you will be using to code your finger is called Arduino. You will also be using the document Thinkershield, for your own understanding. If you go into downloads, it will explain how to obtain these things.
The coding below is for your Flexi Strip. This means that the servo will move, according to how much you bend the Flexi Strip.You will need to have a completely blank Arduino file open. Paste this into your file.
Here is the Code:
// Include Servo library
#include Servo.h (this will need to go inside the triangle brackets; <>).
Servo myservo; //create servo object to control a servo
void setup() {
myservo.attach(2); // attaches the servo on pin 2 to the servo object
// Configure flex sensor pin
pinMode(A0, INPUT_PULLUP);
Serial.begin(9600);
}
void loop() {
int flexSensor = analogRead(A0);
// Values from sensor are about 400 -> 700; we need to convert this to about 0 -> 180
int angle = (flexSensor - 400) / 2;
Serial.println(angle);
myservo.write(angle); // Set servo position
}
Once you have done this, you need to find the tab at the top of your screen;
Click on Tools
Click on Serial Monitor
Change the number to 9600
This will allow you to see a range of numbers.
Hold your Flexi Strip at its base and record the number displayed on the screen. It must be a positive integer. If it is not positive, then try bending the Strip different ways until you get a positive number.
After finding the lowest number, you bend the Flexi Strip as if it were a normal finger, and record the highest number you can see. These two numbers will replace the 400 and 700 in the code.
Place the smaller number as the 400 and the largest as the 700. This is your range.
Find the difference of these two numbers. Then find a number that divides into 180. i.e. 360 / 2 = 180. On the next line of coding, place the higher number where the 400 is, and the lower where the 2 is.
Then send the code.
Once you have sent the code, connect your Nano-Board to your computer.
Go into Tools.
Click on Board.
Click on Arduino Nano.
Now send the code.
This allows the code to be read off the Nano Board as we won't be using the Arduino Board anymore.
Here you will find a link to YouTube. This link will explain the code to you.