Issues with merging basic control sketch with line tracking sketch.

Hello world,

I am in the process of building an arduino Tank robot. I am using IR remote to control it. As of right now I have basic control, forward, back, left, right etc. turn LEDs on off, and sound buzzer. I have line following and avoidance modules installed as well. I have 3 basic sketches to perform basic manual control, line following, and avoidance. each one works fine independently of each other. I am trying to figure out how
to incorporate the three into one sketch using the numbered buttons on IR remote to select line tracking,
avoidance, and still have manual control as well. I figured out earlier today how to get the IR hex codes in serial viewer and how to add continuous movement when holding down the four way directional buttons on the remote. I have been trying to merge the basic control sketch with line tracking but cant quite get it. I put the bot on the line to follow but have to continually press the assigned 1 button on remote for it to follow the line.(it should run with one button press until its told to stop or cant negotiate the track.) If i run just the line tracking sketch its fine same as the avoidance sketch. I havn’t even tried to incorporate avoidance yet. I am going to add my basic sketch and the line tracking sketch below in an attachment and my attempted merger of the two.
I am fairly new to arduino language, have some limited python and html. I can usually figure it out if i have examples and stare at it long enough. I sure this build is above my paygrade, but hey I did figure out the above stuff earlier today.

Hardware Genuine arduino uno r3, wifi expansion board esp13 shield, motor driver module, Standard tracking sensor using 2, IR sensor, buzzer sensor, voltage meter, and 1 ultrasonic sensor.

Arduino Continuous IR with LT.doc (72 KB)

You already posted this question in Sensors.

I meant to post in programming, not sensors, is more a programming issue, my bad wasn't sure how to delete from sensors, been up over 24 hours working on this project. did you happen to look at the sketches? Just curious, since you have a keen eye for the obvious.

You haven't posted any sketches, just attached some sort of Word document. The thread "How to use this forum - please read" at the top of every forum contains some useful information, including the correct way to post code so it will be easy for people to read.


I did follow how to use this forum, I put the sketches in a word doc highlighting the changes so i could upload them for other posters convenience. Its says to, "try not to post a lot of code." As I stated I'm new to this. I try to figure things out before I ask. I have been beating my brain on this project for over 24 hours. I tried to find examples of code and what not. Everything I found doesn't really show what Im trying to do. Most examples are for specific robots with one feature and don't explain the process of merging different functionality into one sketch. I got this project as a gift because I just had a full wrist fusion and can't go back to work for 6 months. I really didn't want to post. I have never used forums before. I tried searching the forum here but couldn't find anything. I find it discouraging that when I try to ask for help I get flak for being new. You "slipstick" posted earlier on another question which gave me an idea of what i needed to do and i figured it out. Thanks for that, but be a little more forgiving for the new guys. I want to learn and this robot project seems like a good place to start. Maybe a Little complicated for a "noob". I thought I did well to figure out what i was trying to do earlier in the day considering its all new to me.

Like many other people I can't easily read Word documents when I'm reading the forums using my phone or tablet. What I can't read I can't try to help with.

It has little to do with being "forgiving for the new guys". It's just simple practicality I'm afraid. Even if you do really need to attach something because of the post size limit a zipped text format is usually better than a proprietary format like MS Word.