#include "Ultrasonic.h"
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
// put your setup code here, to run once:
lcd.begin();
Serial.begin(9600);
}
Ultrasonic ultrasonic(11, 12); //Ultrasonic ultrasonic(Trig,Echo);
void loop()
{
int a = (Ultrasonic.Ranging(CM));
if (a >= 15 && a < 20)
{ Serial.println("guvenli");
lcd.print("guvenli");
delay(500);
lcd.clear();
tone(3, 2000, 100);
delay(500);
noTone(3);
}
if (a >= 10 && a < 15) {
Serial.println("guvenli dikkat");
lcd.print("guvenli dikkat");
delay(500);
lcd.clear();
tone(3, 2000, 50);
delay(250);
noTone(3);
}
if (a < 5)
{
Serial.println("vurdun");
lcd.print("vurdun");
delay(500);
lcd.clear();**uıhhf
tone(3, 2000, 50);
delay(50);
noTone(3);
}
}
In this code i'm getting an error like this:
C:\Users\*\AppData\Local\Temp\arduino_modified_sketch_113625\sketch_apr29a.ino: In function 'void loop()':
sketch_apr29a:19:22: error: expected primary-expression before '.' token
int a = (Ultrasonic.Ranging(CM));
^
exit status 1
expected primary-expression before '.' token
**uıhhfin line 40 (which does seem like a typo), your sketch compiles fine for me. I don't receive the shown error. I'm using Arduino IDE 1.8.5 and Arduino Uno as target board.