0
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); //

#include <SharpIR.h>

#define IR A0 // define Sharp IR signal pin
#define model 1080 // the model of the IR module

/*
 * GP2Y0A02YK0F --> "20150"
 GP2Y0A21YK --> "1080"
 GP2Y0A710K0F --> "100500"
  GP2YA41SK0F --> "430"
 */


void setup()
{
  lcd.begin(16,2);
  lcd.backlight();
}

void loop()
{

  //start of loop Robojax code for LCD with I2C
  lcd.print("Robojax IR Test");
  lcd.setCursor (0,1); // go to start of 2nd line
 int dis=SharpIR.distance();
 String distance = String(dis);
 distance ="Distance: "+distance+"cm";
 lcd.print(distance);
  //lcd.print(millis() / 1000);
  delay(500);
 //end of loopcode Robojax code for LCD with I2C
}
  • 7
    Please edit the question and insert complete error log please. – Filip Franik Apr 28 at 14:21
  • It's common practice to first include everything before declaring variables, so swap lines LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // and #include <SharpIR.h> – Michel Keijzers Apr 28 at 14:41
  • 1
    The compiler will have told you exactly you where it found the error. Why do you want us to guess where the error occured? Just point to the relevant part of your code. – StarCat Apr 28 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.