Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include #include Pixy pixy; uint8_t i = 0; // iterate between signatures int state ; //end // Ultrasonic sensor variables #define TRIGGER_RIGHT 4

#include #include #include #include

Pixy pixy;

uint8_t i = 0; // iterate between signatures int state ; //end

// Ultrasonic sensor variables #define TRIGGER_RIGHT 4 //blue right #define ECHO_RIGHT 3 #define TRIGGER_LEFT 9 //black left #define ECHO_LEFT 8 #define PING_MIN_DISTANCE 60 //40 cm = 16 inches

static long rigth_sensor (void); static long left_sensor (void);

long distance_right, duration_right; long distance_left, duration_left; //end LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7,3);

//setting pin for motors uint8_t motor_left = 5; uint8_t motor_right = 6; int speed = 64; //end;

void setup() { // serial monotor Serial.begin(9600); Serial.print("Starting... "); //lcd lcd.begin(20,4); lcd.clear(); pixy.init();

//motors pinMode(motor_left, OUTPUT); pinMode(motor_right, OUTPUT); // //ultrasonic sensor pinMode(TRIGGER_RIGHT, OUTPUT); pinMode(TRIGGER_LEFT, OUTPUT); pinMode(ECHO_RIGHT, INPUT); pinMode(ECHO_LEFT, INPUT);

}

void loop() { pixy.getBlocks(); Serial.println (pixy.blocks[i].signature); if (pixy.blocks[i].signature == 2) // signature 1 { state = LOW; Serial.println("Stop, sig 2 "); } if (pixy.blocks[i].signature == 1) // signature 2 { state = HIGH; Serial.println("Forward , sig 1"); }

switch (state) { case HIGH :{ motor_stop(); lcd.setCursor(0, 2); lcd.print("All Stop "); break; } case LOW :{ obstacle_avoid(); delay(1000);

} } }

image text in transcribed

SCAD BOT Ardu no 1.8.5 File Edit Sketch Tools Help SCAD_BOT no matching functon for call to 'LiquidCrystal_12C::LiquidCrystal_12C(int, int, int, int, int, int, int, int, inty 5:51 PM 0 Type here to search 2/27/2019 1) SCAD BOT Ardu no 1.8.5 File Edit Sketch Tools Help SCAD_BOT no matching functon for call to 'LiquidCrystal_12C::LiquidCrystal_12C(int, int, int, int, int, int, int, int, inty 5:51 PM 0 Type here to search 2/27/2019 1)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions