José Juan Sánchez Hernández

Lifelong Learner

About me
Research
Phd Thesis
Teaching
Android
Experiments
NanoPlayBoard
Talks
Blog

How to build a basic obstacle avoiding robot using NanoPlayBoard

October 18, 2016


This article shows you how to build a basic obstacle avoiding robot using NanoPlayBoard.

Inventory

Inventory

Sketch

Upload this sketch on the NanoPlayBoard:

#include <NanoPlayBoard.h>

#define MAX_DISTANCE_FROM_OBSTACLE 5

NanoPlayBoard board;

void setup() {

}

void loop() {
  int distance = board.ultrasound.pingCm();
  if (distance < MAX_DISTANCE_FROM_OBSTACLE && distance !=0) {
    board.servos.stop();
    board.servos.goBackward(1000);
    board.servos.goRight(1000);
  } else {
    board.servos.goForward();
  }
}

The source code of this sketch is available on GitHub.

NanoPlayBot

Right side

Inventory

Left side

Inventory

Video

Resources