Updated: 5/17/21

COLLISION SENSORS SECTIONS:

COL1 - right IR sensor U7 and D19
COL2 - center IR sensor U6 and D18
COL3 - left IR sensor U5 and D17

PROPER UPLOADING:

Press and Hold the SYS RST (SW3) then switch ON the Power (SW1)
and Click Upload. Release SYS RST when done.

PBOT 2018 FUNCTION REVIEW:

  • Set IR collision sensor for reading if there’s a block or object detected

PBOT.COL1_RIGHT()

PBOT.COL2_CENTER()

PBOT.COL3_LEFT()

Notes: Output reads: No object detection = 0 or LOWObject detected = 1 or HIGH

Ex.: 

GET STARTED:

  1. Setting Up your Arduino IDE with ArduBlocks and the eGizmo PBOT2018 Library. (Read Here)
  2.  In ArduBlock, using PBOT 2018,

START WITH ADDING A BLOCK

 “PBOT BEGIN”

  • Adding PBOT BEGIN Block -  Setting Up the eGizmo_PBOT2018,Wire library and Turn ON all the Motors.

SERIAL MONITOR BY ADDING THE SERIAL PRINT BLOCK

USE THE DROP-DOWN ARROW TO SELECT SENSOR:

  • Click the Drop-down arrow to select immediately the collision sensor.

  • As you can see the 3 IR Collision sensors appears.


FOR OBJECT DETECTION

//Right

//Center

//Left

  • For No Object detection =  change the Mode of collision sensors to LOW.

Avoid_collision.ino

/**********************************************
e-Gizmo PBOT Controller - AVOID COLLISION.ino
This is for collsion sample sketch to avoid
crashing on the wall or any objects that blocking
way of the PBOT.
Reading the 3channel Collision sensors:
PBOT.COL1_RIGHT();
PBOT.COL2_CENTER();
PBOT.COL3_LEFT();
Output reads:
No object detection = 0 or LOW;
Object detected = 1 or HIGH;
Codes by
e-Gizmo Mechatronix Central
http://www.e-gizmo.net
June 5,2018
************************************************/
#include "eGizmo_PBOT2018.h"
#include <Wire.h>
eGizmo_PBOT2018 PBOT;
void setup() {
Serial.begin(9600);
Wire.begin();
PBOT.BEGIN();
PBOT.ALLON();
PBOT.SPEED(MOTOR_BOTH, 120);
}
void loop() {
if(PBOT.COL2_CENTER()){ //center object detection
change_direction();
}
delay(200);
}
//Sample Function for changing directions
void change_direction(void) {
boolean cw = HIGH;
PBOT.DIRECTION(MOTOR_BOTH, MOTOR_REV);
delay(500);
if (cw) {
cw = false;
PBOT.DIRECTION(MOTOR_A, MOTOR_FWD);
} else {
cw = true;
PBOT.DIRECTION(MOTOR_B, MOTOR_FWD);
}
delay(500);
PBOT.DIRECTION(MOTOR_BOTH, MOTOR_FWD);
}