i am looking for some help with a project i am working on with my ten year old son. we are new to the Arduino community and have been working on some fun projects. My son wanted to try and take three of the projects we did (found them on instructables) and put them together as one. Basically we have and HC-SR04 ultrasonic distance sensor, L298N (H-bridge), IR remote (and 1838 receiver), and an Arduino uno.
We have a program that uses the ultra HC-SR04 ultrasonic distance sensor and the L298N (H-bridge) as an obstacle avoidance system that works by itself.
Unfortunately we do not know how to adjust the code for speed control and we want to add the IR remote and receiver as an override so that if the 0 (zero) button on the remote is pressed then instead of doing the obstacle avoidance it just uses the <>^... keys on the remote to move, and then if you press the # key on the remote it goes back to the obstacle avoidance part of the program.
i know that for the speed control to make it go slower i need to do something like, analogWrite(variable, 125) //value between 0-255 but i am not sure how to connect it all to the arduino uno and exactly how to write the program.
also for the obstacle avoidance program i am going to paste below, i do not want to use the LED or buzzer, just the L298N driver and the sensor. I want to make the build and the code as simple as possible where it has a slower speed (maybe 125/255), HC-SR04 distance sensor, IR remote, and receiver and thats it. I could imagine this may be a lot to ask but if someone could take the time to help my son and I, we would really appreciate it.
ps there is a pushbutton If statement with the obstacle avoidance i think that for this project we may need to use something like that to constant checking the status of the IR remote to see if the 0 (zero) button or # button have been pressed.
P.S.-#2: if you know of an instructables for this type of project we would appreciate it if you could add the link to this thread.
THANK YOU ALL IN ADVANCE
i have auto formatted it to make it easier to use. also, i forgot but i already figured out the speed control thing for the irremote project that i did with just the ir remote. lastly i got the library for the IRremote from github; below is the zip file for the library. (i did not install the standard arduino library). i have a program that serial prints responses to every button on my remote and have also attached that below.
IR_Remote_Control.ino (4.12 KB)
Obstacle_Avoidance.ino (4.7 KB)
Arduino-IRremote-master (1).zip (79.4 KB)
ir_remote_test.ino (2.13 KB)