Pinguino Forum

Full Version: Controll a servo with a potentiometer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hey guys.

Its really important for me If someone knows the solution to this.

I try to controll a servo with a variable resistor in pinguino with a 18f4550. If Resistence =0, Move servo to 0 degress, if resistence máxValue , put servo on 180 degrees. That's all I need to do.

I put this code but it doesn't work....
I put it on Arduino, and works great but in pinguino just move without sense. :Sad And I need for my project in Pinguino only.

int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin

void setup()
servo.attach(9); // attaches the servo on pin 9 to the servo object

void loop()
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
servo.write(9, val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there

I ll be really happy I you could help me in something. Smile
which pinguino IDE are you using?

(30-05-2016, 01:01 AM)derf158 Wrote: [ -> ]which pinguino IDE are you using?


right now I have 12 version, I could install v11 too but It seems its not working too. 

In other page says it will work with X.3 Version of the IDE, but I could not install it good. The IDE doesn't upload the program to the Pinguino.
what value pot are you using 10k?

(30-05-2016, 03:36 AM)derf158 Wrote: [ -> ]what value pot are you using 10k?


i will try this on my v12 tomorrow
(30-05-2016, 04:10 AM)derf158 Wrote: [ -> ]i will try this on my v12 tomorrow

Thanks dude, If it works for u , let me know how. :Big Grin I ll be so grateful. 

Nice day or night.
i tried the PDE you posted and it worked i have attached a zip file of my p8 folder rename yours and insert mine it should work.
Bro I am so sad, It shoud work too but its the same, the servo moves without sense, but I ill try reinstalling it .
Dude, can u send me a zip file whit the v12 carpet of your pinguino Big Grin or a page where i see the steps to intall from zero. Maybe I did something wrong in that part.

- Or a easy pack for that versión if u have it...(easy pack - no installating required(just like portable))
Or maybe a picture, of your conexionsSmile, I need to try everything before give up :c
Good day! Smile
are you running windows or linux?
Pages: 1 2 3