Hi
I need help eliminating the above error from my Weather Station wind speed sketch, i am using a UNO R3 This is the error message, followed by my sketch
Arduino: 1.8.5 (Windows 7), Board: "Arduino/Genuino Uno"
anemometer:49: error: stray '\342' in program
lcd.print(“Our Weather�);
^
anemometer:49: error: stray '\200' in program
anemometer:49: error: stray '\234' in program
anemometer:49: error: stray '\342' in program
anemometer:49: error: stray '\200' in program
anemometer:49: error: stray '\235' in program
anemometer:51: error: stray '\342' in program
lcd.print(“Windspeed Sensor�);
^
anemometer:51: error: stray '\200' in program
anemometer:51: error: stray '\234' in program
anemometer:51: error: stray '\342' in program
anemometer:51: error: stray '\200' in program
anemometer:51: error: stray '\235' in program
anemometer:68: error: stray '\342' in program
totalWind = totalWind – readings[readIndex];
^
anemometer:68: error: stray '\200' in program
anemometer:68: error: stray '\223' in program
anemometer:90: error: stray '\342' in program
windSpeed = ((sensorVoltage – voltageMin) * windSpeedMax / (voltageMax – voltageMin))*2.232694; //For voltages above minimum value, use the linear relationship to calculate wind speed.
^
anemometer:90: error: stray '\200' in program
anemometer:90: error: stray '\223' in program
anemometer:90: error: stray '\342' in program
anemometer:90: error: stray '\200' in program
anemometer:90: error: stray '\223' in program
C:\Users\dell\Downloads\anemometer\anemometer.ino: In function 'void setup()':
anemometer:49: error: 'Our' was not declared in this scope
lcd.print(“Our Weather�);
^
anemometer:51: error: 'Windspeed' was not declared in this scope
lcd.print(“Windspeed Sensor�);
^
C:\Users\dell\Downloads\anemometer\anemometer.ino: In function 'void loop()':
anemometer:68: error: expected ';' before 'readings'
totalWind = totalWind – readings[readIndex];
^
anemometer:90: error: expected ')' before 'voltageMin'
windSpeed = ((sensorVoltage – voltageMin) * windSpeedMax / (voltageMax – voltageMin))*2.232694; //For voltages above minimum value, use the linear relationship to calculate wind speed.
^
anemometer:90: error: expected ')' before ';' token
windSpeed = ((sensorVoltage – voltageMin) * windSpeedMax / (voltageMax – voltageMin))*2.232694; //For voltages above minimum value, use the linear relationship to calculate wind speed.
^
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: C:\Users\dell\Documents\Arduino\libraries\Newliquidcrystal_1.3.5
Not used: C:\Users\dell\Documents\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
Not used: C:\Users\dell\Documents\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
Not used: C:\Users\dell\Documents\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
Not used: C:\Users\dell\Documents\Arduino\libraries\Arduino-LiquidCrystal-I2C-library-master
exit status 1
stray '\342' in program
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd (0x27, 2, 1, 0, 4, 5, 6, 7, 3,POSITIVE); //address for 20 x 4 LCD
#include <Wire.h>
int serial_in;
//Setup Variables
double x = 0;
double y = 0;
double a = 0;
double b = 0;
const int sensorPin = A1; //Defines the pin that the anemometer output is connected
const int numReadings = 10; //Defines number of reading to calculate average windspeed
int readings[numReadings]; // the readings from the analog input
int readIndex = 0; // the index of the current reading
int totalWind= 0; // the running total
int averageWind = 0; // the average
int inputPin = A1;
int sensorValue = 0; //Variable stores the value direct from the analog pin
float sensorVoltage = 0; //Variable that stores the voltage (in Volts) from the anemometer being sent to the analog pin
float sensorVoltage2 = 0; //Variable that stores the voltage (in Volts) from the anemometer being sent to the analog pin
float windSpeed = 0; // Wind speed in meters per second (m/s)
float voltageConversionConstant = .004882814; //This constant maps the value provided from the analog read function, which ranges from 0 to 1023, to actual voltage, which ranges from 0V to 5V
int sensorDelay = 2000; //Delay between sensor readings, measured in milliseconds (ms)
//Anemometer Technical Variables
//The following variables correspond to the anemometer sold by Adafruit, but could be modified to fit other anemometers.
float voltageMin = .4; // Mininum output voltage from anemometer in mV.
float windSpeedMin = 0; // Wind speed in meters/sec corresponding to minimum voltage
float voltageMax = 2.0; // Maximum output voltage from anemometer in mV.
float windSpeedMax = 32; // Wind speed in meters/sec corresponding to maximum voltage
void setup()
{
for (int thisReading = 0; thisReading < numReadings; thisReading++) {
readings[thisReading] = 0;
}
//Setup LCD display with welcome screen
lcd.begin(20,4);
lcd.print(“Our Weather”);
lcd.setCursor(0, 1);
lcd.print(“Windspeed Sensor”);
delay(2500);
lcd.clear();
lcd.setCursor(0, 0);
Serial.begin(9600); //Start the serial connection
}
//Anemometer calculations
void loop()
{
sensorValue = analogRead(sensorPin); //Get a value between 0 and 1023 from the analog pin connected to the anemometer
// subtract the last reading:
totalWind = totalWind – readings[readIndex];
// read from the sensor:
readings[readIndex] = sensorValue;
// add the reading to the total:
totalWind = totalWind + readings[readIndex];
// advance to the next position in the array:
readIndex = readIndex + 1;
sensorVoltage2 = sensorValue * voltageConversionConstant; //Convert sensor value to actual voltage
// if we’re at the end of the array…
if (readIndex >= numReadings) {
// …wrap around to the beginning:
readIndex = 0;
// calculate the average:
averageWind = totalWind / numReadings;
sensorVoltage = averageWind * voltageConversionConstant; //Convert sensor value to actual voltage
//Convert voltage value to wind speed using range of max and min voltages and wind speed for the anemometer
if (sensorVoltage <= voltageMin) {
windSpeed = 0; //Check if voltage is below minimum value. If so, set wind speed to zero.
} else {
windSpeed = ((sensorVoltage – voltageMin) * windSpeedMax / (voltageMax – voltageMin))*2.232694; //For voltages above minimum value, use the linear relationship to calculate wind speed.
}
}
//Max wind speed calculation
x = windSpeed;
if (x >= y) {
y = x;
} else {
y = y;
}
//Max voltage calculation
a = sensorVoltage;
if (a >= b) {
b = a;
} else {
b = b;
}
//Print voltage and windspeed to serial
Serial.print("Voltage: ");
Serial.print(sensorVoltage);
Serial.print("Average: ");
Serial.print(averageWind);
Serial.print("\t");
Serial.print("Wind speed: ");
Serial.println(windSpeed);
//Display Wind Speed results to LCD with Max wind speed
lcd.setCursor(0, 0);
lcd.print("Wind Speed=");
lcd.setCursor(11, 0);
lcd.print(windSpeed);
lcd.setCursor(0, 1);
lcd.print(b);
lcd.setCursor(5, 1);
lcd.print(readIndex);
lcd.setCursor(7, 1);
lcd.print("Max=");
lcd.setCursor(11, 1);
lcd.print(y);
delay(sensorDelay);
}