Hi,
so I have two working pieces of code that I don't know how to combine and need help doing so
code 1 (original/main code)
code 2
when I try to combine the codes most of the functions stop working on the robot
what the program is meant to do is move a stepper motor in the opposite direction until the hall effect sensor senses a magnet. Then the motor can be moved by a joystick (code 2) or by putting in a linear velocity in the keypad and having the motor move on its own
code 2 (joystick) and code 1 (keypad and everything else) work fine by themselves but I need help combining them into one program
I just want the joystick code and include it in the robot code. I don't know if I have it written correctly or there is another way to write it to include it in the robot code
I have this as an attempt to combine the codes but it doesn't work and makes the functionality of both codes not work
Please read this
https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/681310
Then go back and post your code accordingly. The way you posted your code is unacceptable here.
Then read and understand this
http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html
The first thing when ‘combining’ codes, is knowing that it is unlikely to work. An experienced developer might get pretty close on the first attempt, but will likely have to do some debugging.
Once you get over that, work through each of the source programs until you UNDERSTAND how they work, and why they do what they do.
Final step is to have both original programs handy, and start writing a completely new program that incorporates what you found and learned.
Remember - the guy who wrote program #1 has zero awareness of what the guy who wrote program #2 was going to do, or was thinking.
You have to do that.