Can anyone help me to combine these to sketch. Iam trying to make a smartphone controlled car with robotics arm. Iam using 3 servo motor, 1 hc-05, 2 gear motor, 1 l298n motor driver and a arduino nano.
Have you tried to combine them yourself ?
UKHeliBob:
Have you tried to combine them yourself ?
I don't know how to do it can you please do it for me?
You should first Google 'combine arduino sketches', this will give you some hints.
If you are (very) lucky, meaning if your sketches are not too complex or can run independently, it will be straightforward:
- put all the lines before each setups of your 2 codes in a new blank ino file, remove any redondance
- combine the content of both setups (discard any redondant lines)
- create 2 new functions called loop1 and loop2 (for example) and copy the contents of your loops in these functions
- write a new loop as follows
void loop() { loop1(); loop2(); }
But there are chances that this will not work as you want, because of possible delays or interactions between your 2 codes. Then you'll have to merge the 2 loops in only one, and this will require to think more than what I told you above...
lesept:
You should first Google 'combine arduino sketches', this will give you some hints.If you are (very) lucky, meaning if your sketches are not too complex or can run independently, it will be straightforward:
- put all the lines before each setups of your 2 codes in a new blank ino file, remove any redondance
- combine the content of both setups (discard any redondant lines)
- create 2 new functions called loop1 and loop2 (for example) and copy the contents of your loops in these functions
- write a new loop as follows
void loop() { loop1(); loop2(); }
But there are chances that this will not work as you want, because of possible delays or interactions between your 2 codes. Then you'll have to merge the 2 loops in only one, and this will require to think more than what I told you above...
Can you please do it for me. Iam nooby in programming. Iam making this project for my school exhibition
Iam making this project for my school exhibition
You mean that you want someone else to make this project for your school exhibition
You will never progress beyond being a "nooby" unless you try things for yourself
UKHeliBob:
You mean that you want someone else to make this project for your school exhibitionYou will never progress beyond being a "nooby" unless you try things for yourself
Please
I will gladly provide help with a program that you write but I am not going to do it for you
Apart from your pride is there anything riding on the program working ?
I can't do it for you, like Bob says you must do the first steps by yourself.
Reading your files, it appears that you are almost licky. The 2 codes should merge quite easily, except for 2 things:
- you use the pins 9 to 11 in both codes for differents things,
- and the processing of the commands from the serial link has to be re written to be compatible of both needs.
Can you please do it for me. Iam nooby in programming. Iam making this project for my school exhibition
Do your own homework, please, make an attempt, see how far you get ask specific question about specific parts, try and compile, post errors & sketch within </> code-tags please...
There's a tutorial for that.
lesept:
I can't do it for you, like Bob says you must do the first steps by yourself.
Reading your files, it appears that you are almost licky. The 2 codes should merge quite easily, except for 2 things:
- you use the pins 9 to 11 in both codes for differents things,
- and the processing of the commands from the serial link has to be re written to be compatible of both needs.
I tried little bit then how to combine two serial available. One is for servo control via Bluetooth and another is dc motor control via Bluetooth using l298n
Hari220903:
I tried little bit then how to combine two serial available. One is for servo control via Bluetooth and another is dc motor control via Bluetooth using l298n
...and?
how to combine two serial available
It sounds like you need 2 serial interfaces
Take a look at the SoftwareSerial library
Hari220903:
I tried little bit then how to combine two serial available. One is for servo control via Bluetooth and another is dc motor control via Bluetooth using l298n
So first show us your attempt to combine the two sketches and explain what works and what doesn't.
If you are using a single smartphone app to control the servos and the DC motors then you are only using one Bluetooth connection so what's the problem? If you are not using one smartphone app then tell us what exactly you are using.
Steve
I choose two projects from the internet. I need to combine those. The idea was to control a car and robotic arm using smartphone. there are two separate codes. I need to combine those codes.
Hari220903:
I choose two projects from the internet. I need to combine those.
We get that. But this:
slipstick:
If you are not using one smartphone app then tell us what exactly you are using.
... specifically asks about the BT app or apps sending the controls in.
The problem with just taking code from the Internet is that you probably have no idea how it works. That can make it you difficult to combine the sketches. But YOU are the only one who wants the sketches combined so YOU have to put some effort in yourself.
As I said before, if you make an attempt at combining the sketches and post it here we'll help you to get it working. You'll also need to answer the questions you're asked. Just ignoring people's questions will not encourage them to help you.
But if you just want someone else to do all the work then try posting in Gigs and Collaborations but you'll probably need to pay someone to do the work for you.
Steve
slipstick:
The problem with just taking code from the Internet is that you probably have no idea how it works. That can make it you difficult to combine the sketches. But YOU are the only one who wants the sketches combined so YOU have to put some effort in yourself.As I said before, if you make an attempt at combining the sketches and post it here we'll help you to get it working. You'll also need to answer the questions you're asked. Just ignoring people's questions will not encourage them to help you.
But if you just want someone else to do all the work then try posting in Gigs and Collaborations but you'll probably need to pay someone to do the work for you.
Steve
I did it. It works. Thank you so much for the help. Now I need to slow down the dc motor.