Potentiometer Programming help for new Easyc Students ( Autonomous )

I will provide some code for beginners on Potentiometers

But first if you are going to use them you will need to create a variable for it/ or them Here [ATTACH]8984[/ATTACH]

and here is the code you will need for the whole program

[ATTACH]8983[/ATTACH]

Here is Basically what everything i just said is

1 (Unsigned int == Potentiometer)
2 (If == (Set Distance) of Lift
3 (Set Motor) == Lift)
Code.jpg
Variables.jpg

if I am reading your code corectly the second line switches off the motor once it reaches the point, right?

I if thats the case, I would rather do


if >=(Set Distance)

since the potentiometer can skip values. My complete code would be something like this:


Unsigned int pot == Potentiometer //get the potentiometer value
if(pot < wantedvalue) { //check if we need to move up more
    motor(lift, 256)        //Yup, we need to move up more, so let's do it
} else {
    motor(lift, 127)        //there we go, we reached our desired value. Let's stop the motors
}