Hey everyone I'm new to coding and arduino and I'm literally pulling my hair out and completely fed up searching youtube for help so I'm really hoping I can get some help here.
I have an uno r3 and a 16 channel servo shield and what I'm trying to achieve is to controll up to 16 servos at the same time using a potentiometer for the control.
I'm completely clueless with coding and wiring but I have managed to get one servo working with a potentiometer connected directly to the uno r3 without the servo shield. I just followed a video and downloaded the code so I didnt exactly have to do alot.
Has anyone got any codes and diagrams to help me out please?
It would probably help folk to help you if you gave a link to the anonymous "servo shield" and explain what role you want the potentiometer to play in the servos' control.
Has anyone got any codes and diagrams to help me out please?
As you should already know from reading How to get the best out of this forum - General Electronics - Arduino Forum the forum is about helping you write your own code and helping you find problems with code you have. It is not a place where you can expect code to be just given to you. If the code you want already exists then you need to search for it, however, there's a good chance it doesn't exist. If it doesn't then you have to decide between learning to code and asking for help when you get stuck or paying someone to write the code for you. Which do you want to do?
Thanks for replying I understand what you mean. I should probably give it a go and come back with the code I have come up with and then ask for help/direction.
It's not a lazy thing at all its just my brain really struggles to compute anything code related for some reason
tweedy17:
Thanks for replying I understand what you mean. I should probably give it a go and come back with the code I have come up with and then ask for help/direction.
It's not a lazy thing at all its just my brain really struggles to compute anything code related for some reason
The difficulty for us is it's hard to tell the difference between lazy and not lazy but struggling when someone is new and we have no track record of posts to judge by.
Start with the simple examples and make sure you understand them before moving on. Everyone here wants to help, but we also want to see you making an effort.
tweedy17:
Thanks for replying I understand what you mean. I should probably give it a go and come back with the code I have come up with and then ask for help/direction.
It's not a lazy thing at all its just my brain really struggles to compute anything code related for some reason
The human brain is very flexible and quickly responds to new situations with repetition, meaning practice.
Paul
Thanks for all the advise. I will study the code that iv already used and see if I can make sense of it and go from there. I'll come back in a few weeks with hopefully somthing haha. Thanks again guys
iv got this code here that controls 1 servo with a pot can anyone point me in the right direction of how to set up my shield board please?
i have had a look at the library and i have found the adafruit pwm but my shield board isnt from adafruit, does that matter?
#include <Servo.h> // add servo library
Servo myservo; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
void setup() {
myservo.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, 180); // scale it to use it with the servo (value between 0 and 55)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}
Does your shield come with any documentation? Any information online that we can look at? Does the supplier say that it's compatible with the Adafruit_PWMServo library? It's certainly physically a very different board but it seems to use the same PCA9685 which is what does most of the work.
With no information it's really difficult for us to guess how you're supposed to drive it unless someone here just happens to have seen one before (I haven't!).
Nothing came with it unfortunately but it mates directly over/onto my uno r3 and I have got one servo working so far with the code above. I've been trying to find out out to connect more servos to the board
I don't want to buy one and if you can find any useful information on that page then you have better eyesight than me.
Your existing code isn't using the PCA9685 at all and you will need that if you want to go to 16 servos. You could try it with the Adafruit library example programs and see if they work for you. Other than that I don't know what to suggest.