Learn how to use RoboBlockly's "LArduino" commands to measure distances and avoid collisions, using an ultrasonic sensor plugged in to an Arduino board that is connected to a Linkbot robot.
|LArduino Ultrasonic 1b: Testing the Sensor with a LoopHR||LArduino Ultrasonic 2b: Coding a "Too Close" Trigger with a LoopHR||LArduino Ultrasonic 3b: "Too Close" Trigger (loop) with BlinkingHR||LArduino Ultrasonic 4b: Collision Avoidance (loop)HR|
RoboBlockly at www.roboblockly.com (free)
As shown in the first image below, the VCC pin of the sensor is connected to the 5V pin in the Power section of the Arduino, and the Gnd pin of the sensor is connected to one of the GND pins in the same section. The sensor's Trig pin is connected to digital pin 9, and the Echo pin is connected to digital pin 8. The image also shows how the green, red, and black wires from the white cable connector plug into the A5, A4, and GND pins, respectively. The other end of the white cable plugs into the top of the Linkbot, as shown in the second image below, with a complete view of the Linkbot-Arduino-Sensor connections (plus an LED module attached using wires instead of the direct plug-in method used in the "Blink RGB LED with LArduino" activities).