stray \342 in Program ?

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);
}

You clearly need to learn to use google, or any search engine.

The "problem", and the stupidly simple solution, are quite well known.

And the solution will be exactly the same as it was the last time you asked this question only a week or so ago.

Steve

You copy pasted the code from a site or program that replaced quotes with the stylized quotes that are supposed to look better, but which are Unicode characters not valid here. You can see it in the error, which shows strings enclosed in gibberish characters instead of quotes. Retype the quotes on all the lines the error messages point to.

It's usually a lot easier :slight_smile:

Copy the code that is posted here back into an empty sketch.

Hi PaulS.

The solution maybe stupid to you, are you implying i am stupid, if you are you are the first man in my life to do so, and from someone who does not know me , i find very offensive. I have a First Class Honors Degree in Mechanical Engineering, From Leeds University, UK. Stupid!

I thought i had removed all of the quotation marks, i attach a screen shot of my problem, the sketch stops on the red line, i see no quotation marks, only brackets.

Ray

Your reading comprehension skills seem to be lacking. I said the solution was stupidly simple.

Quote marks are not the only thing mangled by posting code on the web. Minus signs are, too.

Among other things.

Of course, if you had read all the replies, you'd see that the answer that you could have found was posted AGAIN.

I have a First Class Honors Degree in Mechanical Engineering, From Leeds University, UK.

Well, la de dah.

Hi PaulS.

You are right again, what's it like being right all the time, my reading comprehension could be better, but i am not a teacher nor a full time student, as stated before i am a 70 year old Mechanical Engineer , with over 45 years of service in UK industry, you on the other hand are totally lacking in people skills, such as communication, as for your "la de dah" comment, how old are you 10, or maybe 12 ? the comments of a child.

If you do not like what I say and do, why do you bother to reply to my requests for help and assistance / guidance, you would surely get more satisfaction out of life, other than replying to la de dah old timers, like me, who don't understand your brand of the English language.

how old are you

61, and I too have a degree in Mechanical Engineering and 39 years experience developing computer programs.

The difference between us is that I KNOW how to use google, and I'm not afraid to.

PaulS

That's great, a bit of respect at last. I was late into using Computers, i got left behind in the beginning, everything i know now i have learned since i retired from the rat race, i have used Google, but i find you are often led astray, that's why i use this Forum, talking to real people with a mutual interest, i perhaps need more practice asking Google the right questions?

Ray

(deleted)

Hi Mrs Drew.

I am tempted by your offer, excuse my novice ness but how do i pm you?

Regards

Ray