Go Down

Topic: Arduino UNO line follower code, no driving unit, just board (Read 68 times) previous topic - next topic

Lukybil

Hi, im sorry for really stupid question. I have to code line following robot and Im searching code (for more than 6 hours today...). Problem is, that literally every single robot uses some driving unit. I cannot do it on my own, and this is my last hope. I have to do this to 7:00 Am...

Robot has to work, because it worked last year, but I needed to change code and I do not have the original.

I use 5v pin, ground pin, 5,6 pins fordigital input from sensors and 8,9 for digital output for motors.

It has work like this:
If left sensor detect black color, right motor get more speed, while is black color detected. The same on the other side.
When they detect black both (T), they stop.

Thank you for reply, I had just free days to do this... Im sorry once again.

slipstick

Every robot that ever worked has "some driving unit". You cannot drive motors direct from pins.

And even if someone wanted to write you some code they couldn't since you have given no details of what sensors or motors or Arduino you are using.

And it's already past 7am here so I guess it's too late anyway.

Steve

vinceherman

Deadlines aside, a common approach is to test individual components.

Can you read your sensors?  Write a sketch that reads both sensors and prints the values to the serial monitor.
Move the sensors around your line and note the values of the readings.  Those tell you what you need to test against to determine the relative location to the line.

Can you run the motors?  Write a sketch that simply runs the motors.  Maybe make it vary the speed - 1 second at 100%, then one second at 90% and so on.

After you have confirmed that you have the physical wiring working properly, and understand how to interact with the components, only then can you expect to pull it all  together into a single sketch.

Go Up