Hi,
I'm just starting to program my arduino and I'm getting this error. I have no previous programming experience.
Can anyone shed some light as to what I'm missing.
I'm trying to read a variable and display it on the LCD dispaly instead of the PC using the serial port monitor.
Thank you for your help.
Arduino: 1.6.4 (Windows 7), Board: "Arduino Uno"
Arduino_sensor_ultrasonico.ino: In function 'void setup()':
Arduino_sensor_ultrasonico:44: error: expected unqualified-id before '.' token
Arduino_sensor_ultrasonico.ino: In function 'void loop()':
Arduino_sensor_ultrasonico:72: error: expected unqualified-id before '.' token
expected unqualified-id before '.' token
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
This is my program:
#include <LiquidCrystal.h>
// the pins connected to the Ultrasonic sensor
int echoPin = 9;
int trigPin = 10;
int lcdRSPin =12;
int lcdEPin =11;
int lcdD4Pin =5;
int lcdD5Pin =4;
int lcdD6Pin =3;
int lcdD7Pin =2;
LiquidCrystal lcd (lcdRSPin, lcdEPin, lcdD4Pin, lcdD5Pin, lcdD6Pin, lcdD7Pin);
void setup()
{
// set up serial
LiquidCrystal.begin (9600);
// set the pinmode on our ultrasonic echo, and tric pins
pinMode(echoPin, INPUT);
pinMode(trigPin, OUTPUT);
}
void loop()
{
float distanceCentimeters;
int pulseLenMicroseconds;
// bit-bang a small square wave
// on the trig pin to start the range
// finder
digitalWrite(trigPin, LOW);
delayMicroseconds(20);
digitalWrite(trigPin, HIGH);
delayMicroseconds(100);
digitalWrite(trigPin, LOW);
// measure the pulse length from the echo pin
pulseLenMicroseconds = pulseIn(echoPin, HIGH);
// calculate the distance using the speed of sound
distanceCentimeters = pulseLenMicroseconds / 29.387 / 2;
// print it out over serial
LiquidCrystal.println (distanceCentimeters);
delay(100);
}