Step #11-2 : calibrating the ultrasonic head

arduino4fun
Site Admin
Posts: 37
Joined: Mon Jun 06, 2016 1:16 pm

Step #11-2 : calibrating the ultrasonic head

Postby arduino4fun » Thu Jun 09, 2016 1:02 pm

Calibrating the ultrasonic head, it's important to fix the support of the servo containing the ultrasonic sensor in the axis of the vehicule; all you need to do is running the sketch below, once it has ran for 2/3 second, unplug the power and adjust the head by un-screwing it and replace it back in the right position to match the pictures below.

Code: Select all

// ---------------------------------------------------------------------------------------------------------------
 // This sketch calibrates the servo motor to put it in the axis
 //
 // SERVO -- Sensor Shield V5
 // VCC -- + - red
 // GND -- - - bruin
 // S(ignal) -- 3 - orange
 //
 //
 // https://www.facebook.com/arduino4fun
 // http://www.arduino4fun.com
 // ---------------------------------------------------------------------------------------------------------------

‪#‎include‬ <Servo.h>

Servo myservo; // Set myservo

// servo controls
 int servoPin = 3; // servo connected to pin #3
 int ServoOk = 100; // Provision for the just measure

void setup ()
 {
 // Enable Serial Interface
 Serial.begin (9600);

// Servo
 myservo.attach ( servoPin ); // Define servo motor output section 3 pin (PWM)
 }

void loop ()
 {
 myservo.write ( ServoOk ); // Align ultrasonic head forward
 Serial.println( "looping...." );
 }
 


Image
Image
Image

Return to “Multifunction Bluetooth Controlled Robot Smart Car Kits For Arduino”

Who is online

Users browsing this forum: No registered users and 0 guests