# coding help

**URL:** <http://community.robotshop.com/forum/t/coding-help/8801>\
**Category:** General Discussions\
**Tags:** legacy, flex-sensor-coding\
**Created:** [December 19, 2010, 1:01pm UTC](http://community.robotshop.com/forum/t/coding-help/8801 "2010-12-19T13:01:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![phozon](http://community.robotshop.com/forum/letter_avatar/phozon/32/6_449c533f586939b6e5f246632a46421f.png) [@phozon](http://community.robotshop.com/forum/u/phozon)\
**Post date:** [December 19, 2010, 1:01pm UTC](http://community.robotshop.com/forum/t/coding-help/8801/1 "2010-12-19T13:01:46Z")

</div>

i'm done making a robot hand fr my school fair. it uses 1 flex sensor and 1 servo...i found a code fr it on itp...this is fr arduino...but sadly something happened and my fake arduino mega burnt out....now i have 2 do it on my picaxe

the arduino code is this

&nbsp;

```
Updated 08 Sep 2009by Rory NugentCreated 20 Jan 2009by Tom Igoe\*/

#include \<Servo.h\> // include the servo library

Servo servoMotor; // creates an instance of the servo object to control a servo

int analogPin = 0; // the analog pin that the sensor is on  
int analogValue = 0; // the value returned from the analog sensor

int servoPin = 2; // Control pin for servo motor. As of Arduino 0017, can be any pin

void **setup** () {  
servoMotor.attach(servoPin); // attaches the servo on pin 2 to the servo object  
}

void **loop** ()  
{  
analogValue = analogRead(analogPin); // read the analog input (value between 0 and 1023)  
analogValue = map(analogValue, 0, 1023, 0, 179); // map the analog value (0 - 1023) to the angle of the servo (0 - 179)  
servoMotor.write(analogValue); // write the new mapped analog value to set the position of the servo  
delay(15);
```

```

```

```

```

```
the competition is 2morro so plz help me with the code…im sure it is simple but im a noob…help will be really appreciated
```

&nbsp;

---

<div class="post-metadata">

**Author:** ![fritsl](http://community.robotshop.com/forum/user_avatar/community.robotshop.com/fritsl/32/40_2.png) [@fritsl](http://community.robotshop.com/forum/u/fritsl)\
**Post date:** [December 19, 2010, 1:50pm UTC](http://community.robotshop.com/forum/t/coding-help/8801/2 "2010-12-19T13:50:34Z")

</div>

**Please read the rules**

Please read the [rules](http://community.robotshop.com/letsmakerobots/lmr/rules)
