Servo controlled with a Pot. Approach 2?

I did it :slight_smile:

1: created an integer for the position.

2: Its a spring loaded pot, (nicked from an xbox controller). So using the serial monitor i found it idles at a value of around 450.
physical slack in the springs etc meant when the pot was released it could sit anywhere 30 units either side of this.
so for nice round numbers, i made it so that "if the pot value is greater than 500, steadily increase the position integer, if less than 400, steadily decrease it.

3: write integer to servo

Loop.

Quite chuffed with myself, not least because it only took me half an hour or so (and i still find this game a bit of a struggle)

now im going to fiddle with it so that it can work as an analogue stick, so further push means faster movement.
bit unnecessary for my purpose, but might as well just out of interest.

I would paste the code, but my computer is a muppet and doesn't seem to be able to copy or cut from the IDE.

still, thought i would share.