controlling servo with load sensor

i have to diiferentiate plastic bottle and glass bottle using load sensor and sort them with servo motor. can u help me with the program…

plastic bottles <100g
glass bottles > 150g

website above is description about my load sensor.

I need help about the basic control servo motor by using load sensor

example when my load sensor detect object weight more than 150g,then my servo will rotate to 80 degree…

shahiril:
example when my load sensor detect object weight more than 150g,then my servo will rotate to 80 degree…

You can use a comparison and a simple if-else structure for that.

Do you know how to read the load sensor ?
If not then now is the time to find out.

Do you know how to control a servo ?
If not then now is the time to find out.

I don’t really know about your sensor, you can ask others but I think I will help you with the Servo Library.

The code is the following. Hope this help.
*If you don’t know // means to the arduino that do not read this.

The code I said if you plug in the value correctly, it will turn to three different trash can, one can for plastic, another for glass, and another for unidentified objects.

#include <Servo.h>
//include Servo Library

Servo yourservo;

//add servo

int servoPin = 13;

void setup()
{
yourservo.attach(servoPin);

//set servoPin(13) as an output

}

void loop()
{
int val = map (port, x, y, 0,1);
//This turn the value from the sensor (port) to the value (val) of 2 values, 1, and 0.

if (val==0); //if the value is 0
{
yourservo.write(180); //turn the servo to 180º
}
else if (val ==1); // if the value is 1
{
yourservo.write(180); //turn the servo to 0º
}
else //if not either of the two cases, or unidentified objects, throw into an unidentified trash bin.
{
yourservo.write(90); //turn the servo to 90º
}
}
[code]
if (val==0);

Bzzzzt!

If you post code like this, please qualify it as "uncompiled/untested" or simply "pseudo-code".