Hi im a newbie here, and i have a project for school where we have to make a car/robot out of, 2 sets of the stepper motor, 1 ultrasonic sensor and 1 IRSensor. So when the ultrasonic scans an obstacle it reverses and turns and also the IRsensor makes the stepper go forward when it scans the floor but then if it doesnt it will stop and reverse then turn. I need help on how to do the coding please. I want to know how to code them all of the sensors and the motor combined. (sorry for bad grammar)
Find each device's "datasheet" and a "library" then write a small sketch to test each device to understand how to make it work.
Look at the list of requirements and rate them on importance. I would say "a floor" is most important, then an obstacle on the floor, then moving in any direction. Write an instructions list something like this:
- if (scan floor) is not there, stop, reverse, turn, goto 1 (floor)
- if (scan object) is there, stop, reverse, turn, goto 1 (floor)
- if (floor) and (no object) drive a little
- goto 1
Take what you learned from the individual testing phase and create the full program.
2 Likes
And to the other answers: if you need to create this project in two days, and you do not know C++ nor C++ for Arduino, then you should learn it, but for writing this code, you will need to ask ChatGpt4o
1 Like