XOD for Robotics Projects

Robot - Obstacle Avoidance/Line Follower

I am newbie in XOD. Looking for help from expert contributors.
Hardware i am using for Robot:
1- Ardunio Uno
2- L293D Motor Shield
3- For Obstacle Avoidance (Utrasonic Sensor + Servo)
4- For Line Follower (3 in 1 IR Sensor with 5 pins, VCC,GND, L,C,R)
Need help to program them on both on XOD.


  • INa (number, default=1) — the description as it should be seen in the docs
  • RST (pulse, default=never) — the description


  • OUT (number) — the description

Extra info: rationale, edge-cases, details

It probably doesn’t make much sense to have line following and obstacle avoidance in the same program. You are either staying on the line, or you are avoiding obstacles. The only option that might make sense is to stop if there is something blocking the line.

I’m not sure how the group in general feels about posting complete solutions to questions that are the most obvious projects for any robotics class to be assigning…

The L293D is an h-bridge controller. Nodes exist for controlling that. I think that particular model has 2 pins for controlling direction of each motor; gweimer/h-bridge has a node for that. Look at the node to determine how it was built, it is a trivial adaptation of the original h-bridge node.

There are also nodes for controlling Ultrasonic sensors. The IR Sensors can be read using either digital-read or analog-read depending on output of sensor. If they have a pot for adjusting sensitivity, they are probably digital.

If you read through the documentation provided in https://xod.io/docs/, it will provide guidance to get you started. My recommendation is to NOT try to write the full program the 1st go. Work with small bits until you can build up the full program. Create a patch that turns on the motors when you push a button. Create another patch that allows you to view output of the IR sensors using watch nodes. Once you understand both of those, start working on how to wire the two together to stay on a line. Write another patch that allows you to display distance of objects from the ultrasonic sensor, then work on putting that into your program to control robot movement.

Note that there will be many real-world issues that will complicate your program. A motor will not immediately stop when you tell it to; it will coast to a stop. If you are moving too fast, your robot will over-run and lose the line even though you have perfect code telling it to turn when it starts to drift off the line. Spacing of sensors, thickness of the line, sensitivity of the sensors, speed of the robot and probably other factors will all have to be balanced out to make it work in the real world. These are all issues you will need to address once you have correct code for an “ideal world”. If your robot is able to follow a line most of the time, but sometimes gets lost, it doesn’t mean your code is wrong, it just means you need to make adjustments for these real-world issues.


Thank you for brief explanation. its really helpful for me. I would go through all the basics and try to consult with you ASAP. And i will back with more questions and looking forward to become your student rather.

Thank you !