Auto boat by adruino

i dont know to create the code for servo to control boat and 2 ultrasonic sensor. Help me !!! create the code .. thanks!

Moved your topic to it's current location as it is more suitable.

Could you take a few moments to Learn How To Use The Forum. Other general help and troubleshooting advice can be found here. It will help you get the best out of the forum in the future.


What do you want the boat to do ?

Start your learning process with the simple examples that come with the IDE or are on line.

There are many for controlling a servo, or using ultrasonic rangers.

HuyHuynh1: create the code .. thanks!

We don't create code for people. We help you with problems that you have when you are creating a program.

If you just want someone to write a program for you please ask in the Gigs and Collaborations section of the Forum and be prepared to pay.

If you want to learn to program yourself the examples that come with the Arduino IDE are a good place to start. They probably cover all the techniques you will need. There are also many online tutorials. Also see the Useful Links Thread.


Simple servo test code you can try with your servo.

// zoomkat 7-30-10 serial servo test
// type servo position 0 to 180 in serial monitor
// for writeMicroseconds, use a value like 1500
// Powering a servo from the arduino usually *DOES NOT WORK*.

String readString;
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

void setup() {

void loop() {

  while (Serial.available()) {

    if (Serial.available() >0) {
      char c =;  //gets one byte from serial buffer
      readString += c; //makes the string readString

  if (readString.length() >0) {
    int n = readString.toInt();