I have been working in a project, it´s with an Ultrasonic sensor and some LEDs and a Nuzzer, but my code is wrong, can you help me? it´s kind of urgent, the note is this one:
no matching function for call to 'LiquidCrystal::LiquidCrystal(int, int, int, int, int, int, int, int, int)'
I´m kind of new so I don´t exactly know what to do, the code is the next one:
#include <LiquidCrystal.h>
#define trigPin 7
#define echoPin 6
#define led 8
#define led2 9
#define led3 10
#define buzzer 3
LiquidCrystal lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3);
int sound = 250;
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(buzzer, OUTPUT);
lcd.begin(16,2);
// lcd.noBacklight();
lcd.setCursor(0, 0);
lcd.print("tecnogame.org");
}
void loop() {
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
for(int i = 0; i < 16; i++){
lcd.setCursor(i, 1);
lcd.print(" ");
}
if (distance <= 100) {
digitalWrite(led, HIGH);
sound = 250;
}else{
digitalWrite(led,LOW);
}
if (distance < 66) {
digitalWrite(led2, HIGH);
sound = 260;
}else{
digitalWrite(led2, LOW);
}
if (distance < 32) {
digitalWrite(led3, HIGH);
sound = 290;
}else{
digitalWrite(led5,LOW);
}
if (distance < 15) { digitalWrite(led6, HIGH); sound = 300; }else{ digitalWrite(led6,LOW); } // En caso de que la distancia sea mayor que 1 metro (100 cm) o menor que 2 cm, indicamos que "no hay obstáculos" if (distance > 100 || distance <= 2){
Serial.println("Sin obstáculos");
lcd.setCursor(0, 1);
lcd.print("Sin obstaculos");
noTone(buzzer);
}else{
Serial.print(distance);
Serial.println(" cm");
lcd.setCursor(0, 1);
lcd.print(int(distance));
lcd.setCursor(2, 1);
lcd.print(" cm");
tone(buzzer, sound);
}
delay(200);
}
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.