Hey guys, i'm going to need some pretty big help this time, the thing is too long for the title so I'm just going to tell you the programming part, I need an arduino to control 2 CR(continuous rotation) servos and 2 90 degree servos , a music player( if code can be squeezed into 1 arduino great! if not, then I'll do 2 arduinos) and light up LEDs when I push button A. So this the entire thing, there are 3 buttons (A,B,C), 2 CR servos , 2 90 degree servos , a music player and LEDs . The CR servos will be in sync so I think i can control both from a single output, same goes for the 90 degree servos . So, the CR servos act as a winch which is connected to a pad, the pad is sitting on button B , when I push button A, both servos will winch up until it hits button C then it stops for 1 minute before it goes back down again until it hits button B then it stops permanently until button A is pressed again. After the button is pressed, i also need the servo to activate the music player , wait 5 seconds then activate the LEDs( preferably shimmering) then its the same for above, goes up for 1 minute then comes back down, music player and LEDs are still activated at this point until it hits button B then everything stops and waits for button A to be hit again .I have only tried to program the going up part but I can't even do that ;-;. If somethings are not understood, please let me know, ANY help is GREATLY appreciated. Thanks for your time
Wow.
Just wow.
Most people can take in information much better if you break it up into sentences and paragraphs.
But to your project.
Have you purchased the hardware?
Break the project down into small manageable pieces.
Can you read buttons?
Can you move servos?
Can you light LEDs?
Do these tasks separately first, then try to combine them.
I have only tried to program the going up part but I can't even do that ;-
So post your failed attempt and say what it does and what you want it to do. Then we might be able to spot what you are doing wrong.
The return key is great for braking up that wall of text into paragraphs.
David_31:
Hey guys,
I'm going to need some pretty big help this time,
the thing is too long for the title so I'm just going to tell you the programming part,I need an arduino to control
2 CR(continuous rotation) servos and
2 90 degree servos ,
a music player( if code can be squeezed into 1 arduino great!
if not, then I'll do 2 arduinos) and light up LEDs when I push button A.So this the entire thing,
there are 3 buttons (A,B,C), 2 CR servos ,
2 90 degree servos ,
a music player and LEDs .The CR servos will be in sync so I think i can control both from a single output, same goes for the 90 degree servos .
So, the CR servos act as a winch which is connected to a pad, the pad is sitting on button B , when I push button A, both servos will winch up until it hits button C then it stops for 1 minute before it goes back down again until it hits button B then it stops permanently until button A is pressed again.
After the button is pressed, i also need the servo to activate the music player , wait 5 seconds then activate the LEDs( preferably shimmering)
then its the same for above,
goes up for 1 minute then comes back down,
music player and LEDs are still activated at this point until it hits button B then everything stops and waits for button A to be hit again
I have only tried to program the going up part but I can't even do that ;-;. If somethings are not understood, please let me know,
ANY help is GREATLY appreciated.
Thanks for your time
Sorry but point form is so much easier to read, and get a breath.
Can you tell us the application, what is it ot be used for?
Tom...
vinceherman:
Wow.
Just wow.
Most people can take in information much better if you break it up into sentences and paragraphs.But to your project.
Have you purchased the hardware?
Break the project down into small manageable pieces.
Can you read buttons?
Can you move servos?
Can you light LEDs?
Do these tasks separately first, then try to combine them.
Sorry , I went on quite a ramble there.
I have bought most of the hardware
I'm trying to do individual parts and "duct taping" together into 1 program
No, buttons are hard
Yes, I can move servos, I tried both 90 degree and CRs
Yes, I can light LEDs
I'll try to work it out some more .Thanks for the help
Grumpy_Mike:
So post your failed attempt and say what it does and what you want it to do. Then we might be able to spot what you are doing wrong.The return key is great for braking up that wall of text into paragraphs.
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
const int buttonPin = 1;
void setup()
{
pinMode (buttonPin,INPUT);
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop(){
digitalRead(buttonPin) ;
{ if (buttonPin == HIGH){
digitalWrite(pos = 0; pos < 190; pos += 1) // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(25); // waits 15ms for the servo to reach the position
}else{ digitalWrite(pos = 190; pos>=1; pos-=1)) // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(25); // waits 15ms for the servo to reach the position
}
}
}
This is the program that I sorta frankensteined together, I took some programs from other people and tried it myself to make sure it works and try to understand the program as best I can then adapt it to what I need it to do
David_31:
This is the program that I sorta frankensteined together, I took some programs from other people and tried it myself to make sure it works and try to understand the program as best I can then adapt it to what I need it to do
But you have not told us what that program actually does or what you want it to do that is different.
It is very time-consuming trying to figure out what's going on without a description.
...R
TomGeorge:
Sorry but point form is so much easier to read, and get a breath.
Can you tell us the application, what is it ot be used for?
Tom...
Sorry, Tom, I ramble when I get to this stuff
Its going to be used for a model rocket, not the launchable ones, I am making a 1/48 scale model of the saturn V rocket plus the Launch Umbilical Tower .
The CR servos are used to winch the rocket up like its actually "launching"
The 90 degree servos are used to swing the swing arms out of the rocket's path
The LEDs are used to recreate the flames that come out of the engines
And the music player is going to play the Countdown and launch of the Apollo11 launch
Below there's a pic of the rocket and an orange for scale, sorry no banana ;-;
Robin2:
But you have not told us what that program actually does or what you want it to do that is different.It is very time-consuming trying to figure out what's going on without a description.
...R
Sorry! Forgot to say the most important part
I just want the CR servo from rest to spin when i push a button A and stop when it hits another button B
Hi,
Okay nice project, so "buttons b and c" are LIMIT switches at each and of the travel of the pad.
OPs Picture.
Can you post a basic diagram of your mechanical layout?
Thanks ..Tom..
David_31:
I just want the CR servo from rest to spin when i push a button A and stop when it hits another button B
Yes.
But in Reply #5 you said " tried it myself to make sure it works" which seems to imply that the program does something, but not exactly what you want. What does that program do?
...R
Robin2:
Yes.But in Reply #5 you said " tried it myself to make sure it works" which seems to imply that the program does something, but not exactly what you want. What does that program do?
...R
The program I got from other people just spins the servo motor's arm then I looked at some more sketches that includes pushing a button to spin a motor then I tried to take the spinning servo part and putting it into the push button to start part .
P.s. I tried the programs before i frankensteined them just to make sure they work
Looking at the code in Reply #5 ...
This line (and another like it) makes no sense
digitalWrite(pos = 0; pos < 190; pos += 1)
What do you think it does?
Is it intended to be
for (pos = 0; pos < 190; pos += 1)
...R
[/quote]
TomGeorge:
Hi,
Okay nice project, so "buttons b and c" are LIMIT switches at each and of the travel of the pad.
OPs Picture.
Can you post a basic diagram of your mechanical layout?
Thanks ..Tom..
Hi Tom, is this what you asked for?
Robin2:
Looking at the code in Reply #5 ...This line (and another like it) makes no sense
digitalWrite(pos = 0; pos < 190; pos += 1)
What do you think it does?
Is it intended to be
for (pos = 0; pos < 190; pos += 1)
...R
Yeah you are right! the original code is a for a CR servo sweep program, it goes 180 degrees, sweeps back to 0 and goes on to -180 degrees
Hi, David.
Yup they will help.
You should be able to export of download your schematic, rather than a screen dump.
Your ButtonA and LIMIT switches B and C, need to be wired differently;
This diag should help.
Also you will need a separate supply for the servos, they pull more than 1A each on peaks and the arduino 5V pin cannot supply that total current.
Tom.....
David_31:
Yeah you are right! the original code is a for a CR servo sweep program, it goes 180 degrees, sweeps back to 0 and goes on to -180 degrees
OK. Then correct the program, post the updated code and tell us what it actually does and what you want it to do that is different.
Debugging computer programs is a series of very small steps.
...R
Thank you Tom and Robin!
I'll try these out and let you all know the results