I'm really new to the Arduino system, and I'm trying to do a project, which is basically a water quality controller, with multiple sensors (pH, Temperature, Conductivity, Dissolved oxygen etc...) which gives us the values for all these parameters.
The code for this project is already written and adapted to the hardware. This code is composed of multiple files (.h and .ccp), 2 files for each sensors and one main file (.ino) to run the complete system. Here is one example file:
/**********************************************************************************
* GravityEc.h
* Copyright (C) 2017 DFRobot,
* GitHub Link :https://github.com/DFRobot/watermonitor
* This Library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* Description:Monitoring water quality parameters Conductivity
* Product Links:http://www.dfrobot.com.cn/goods-882.html
* Sensor driver pin:A1 (ecSensorPin(A1))
* author : Jason(jason.ling@dfrobot.com)
* version : V1.0
* date : 2017-04-17
**********************************************************************/
#pragma once
#include "GravityTemperature.h"
#include "ISensor.h"
// external GravityTemperature ecTemperature;
class GravityEc:public ISensor
{
public:
// Conductivity sensor pin
int ecSensorPin;
// Conductivity values
double ECcurrent;
public:
GravityEc(ISensor*);
~GravityEc();
// initialization
void setup ();
// update the sensor data
void update ();
// Get the sensor data
double getValue();
private:
// point to the temperature sensor pointer
ISensor* ecTemperature = NULL;
static const int numReadings = 5;
unsigned int readings[numReadings] = { 0 }; // the readings from the analog input
int index;
double sum;
unsigned long AnalogValueTotal; // the running total
unsigned int AnalogAverage;
unsigned int averageVoltage;
unsigned long AnalogSampleTime;
unsigned long printTime;
unsigned long tempSampleTime;
unsigned long AnalogSampleInterval;
unsigned long printInterval ;
// Calculate the average
void calculateAnalogAverage();
// Calculate the conductivity
void calculateEc();
};
I work on Arduino IDE 2.0.4, Windows 10, and Arduino Uno.
When I try to Verify the code in Arduino IDE, I always get errors like these:
C:\Users\camil\Desktop\KnowFlow_AWM-master\ArduinoUnoDo\WaterMonitor\GravityEc.h:1:1: error: stray '\357' in program
/**********************************************************************************
^
C:\Users\camil\Desktop\KnowFlow_AWM-master\ArduinoUnoDo\WaterMonitor\GravityEc.h:1:2: error: stray '\273' in program
/**********************************************************************************
^
C:\Users\camil\Desktop\KnowFlow_AWM-master\ArduinoUnoDo\WaterMonitor\GravityEc.h:1:3: error: stray '\277' in program
/**********************************************************************************
^
So, I went to some forums and searched for these stray 357, 273 and 277 errors. I found that these errors were the consequence of the presence of goofy/invisible characters in the code. So I deleted the lines were the error was found (1st line in every code file), and replaced it by:
/****
Result was the same, I got the same errors.
I also found that you can use the function : Tools > Fix Encoding and Reload, but this function seems to not exist in my version of Arduino IDE (2.0.4). Is it normal? This function is used to find the goofy hidden characters, and could be very nice to fix my problem.
I tried uploading the file again from GitHub. Could this be linked to my version of Arduino IDE? I will try to use a former one.
This seems to be a common issue but I really don't understand how to get rid of it!