don’t know coding and need help for fiance birthday gift

  arduino-ide, c++

I’ve gotten a lot of the errors to go away, but I’m trying to make the KnowFlow water monitor for my fiance and don’t know the first thing about coding. I’ve pasted everything in as plain text but don’t really know where to go from here. Here is the github. I think the stray7 etc are all special character issues? I will paste in my code for the GravityOrp, GravityPh, and SensorDo since I don’t understand what the last few errors for those three are. Hopefully with that someone can help me out. And I tried to format this question in a not terrible way, but go easy on me.

GravityPh.cpp:1:1: error: stray ‘7’ in program

^
GravityPh.cpp:1:2: error: stray ‘3’ in program

^
GravityPh.cpp:1:3: error: stray ‘7’ in program

^
GravityOrp.cpp:1:1: error: stray ‘7’ in program

^
GravityOrp.cpp:1:2: error: stray ‘3’ in program

^
GravityOrp.cpp:1:3: error: stray ‘7’ in program

^
In file included from C:UsersdaedaDownloadsKnowFlow_AWM-masterKnowFlow_AWM-masterArduinoUnoDoWaterMonitorSensorDo.cpp:2:0:
SensorDo.h:1:1: error: stray ‘7’ in program

^
SensorDo.h:1:2: error: stray ‘3’ in program

^
SensorDo.h:1:3: error: stray ‘7’ in program

^
SdService.cpp:1:1: error: stray ‘7’ in program

^
SdService.cpp:1:2: error: stray ‘3’ in program

^
SdService.cpp:1:3: error: stray ‘7’ in program

^
In file included from C:UsersdaedaDownloadsKnowFlow_AWM-masterKnowFlow_AWM-masterArduinoUnoDoWaterMonitorGravitySensorHub.cpp:7:0:
SensorDo.h:1:1: error: stray ‘7’ in program

^
SensorDo.h:1:2: error: stray ‘3’ in program

^
SensorDo.h:1:3: error: stray ‘7’ in program

^

C:UsersdaedaDownloadsKnowFlow_AWM-masterKnowFlow_AWM-masterArduinoUnoDoWaterMonitorGravityPh.cpp: In constructor ‘GravityPh::GravityPh()’:
GravityPh.cpp:8:23: error: qualified-id in declaration before ‘(‘ token
{void GravityPh::setup()
^

GravityOrp.cpp:10:1: error: expected initializer before ‘void’
void GravityOrp::update()
^~~~

SensorDo.cpp:13:21: error: definition of implicitly-declared ‘SensorDo::~SensorDo()’
SensorDo::~SensorDo()
^

exit status 1
stray ‘7’ in program


#include "GravityOrp.h"

GravityOrp::GravityOrp():orpSensorPin(A3), voltage(5.0), offset(0), orpValue(0.0), sum(0)

{GravityOrp::GravityOrp();}

void GravityOrp::setup()

void GravityOrp::update()
{
  static unsigned long orpTimer = millis();
  static unsigned long printTime = millis();
  static int orpArrayIndex = 0;
  if (millis() >= orpTimer)
  {
    orpTimer = millis() + 20;
    orpArray[orpArrayIndex++] = analogRead(orpSensorPin);
    if (orpArrayIndex == arrayLength)
    {
      orpArrayIndex = 0;
      for(int i = 0; i < arrayLength; i++)
        this->sum += orpArray[i];
      averageOrp = this->sum / arrayLength;
      this->sum = 0;
      this->orpValue = ((30 * this->voltage * 1000) - (75 * averageOrp*this->voltage * 1000 / 1024)) / 75 - this->offset;
    }
  }
}



double GravityOrp::getValue()
{
  return this->orpValue;
}


#include "GravityPh.h"


GravityPh::GravityPh():phSensorPin(A2), offset(0.0f), 
samplingInterval(30),pHValue(0),voltage(0), sum(0)

{void GravityPh::setup()
{
  pinMode(phSensorPin, INPUT);
}
}
void GravityPh::update()
{
  static unsigned long samplingTime = millis();
  static unsigned long printTime = millis();
  static int pHArrayIndex = 0;
  if (millis() - samplingTime > samplingInterval)
  {
    samplingTime = millis();
    pHArray[pHArrayIndex++] = analogRead(this->phSensorPin);

    if (pHArrayIndex == arrayLength)
    {
      pHArrayIndex = 0;
      for (int i = 0; i < arrayLength; i++)
        this->sum += pHArray[i];
      averageVoltage = this->sum / arrayLength;
      this->sum = 0;
      voltage = averageVoltage*5.0 / 1024.0;
      pHValue = 3.5*voltage + this->offset;
    }

  }
}

double GravityPh::getValue()
{
  return this->pHValue;
}

#include "SensorDo.h"
//#include "SoftwareSerial.h"

//SoftwareSerial mySerial(10, 11);

SensorDo::SensorDo()
{

}


SensorDo::~SensorDo()
{
}


//********************************************************************************************
// function name: setup ()
// Function Description: Initializes the sensor
//********************************************************************************************
void SensorDo::setup()
{
    sensorstring.reserve(30);
    //mySerial.begin(9600);
}


//********************************************************************************************
// function name: update ()
// Function Description: Update the sensor value
//********************************************************************************************
void SensorDo::update()
{
    static boolean sensorStringComplete = false;
    if (Serial.available() > 0)
    {
        char inchar = (char)Serial.read();
        this->sensorstring += inchar;
        if (inchar == 'r')
        {
            sensorStringComplete = true;
            //Serial.println("Do avaible");
        }       
    }
    if (sensorStringComplete == true)
    {
        if (isdigit(this->sensorstring[0]))
            doValue = this->sensorstring.toFloat();
        this->sensorstring = "";
        sensorStringComplete = false;
    }
}

//********************************************************************************************
// function name: getValue ()
// Function Description: Returns the sensor data
//********************************************************************************************
double SensorDo::getValue()
{
    return doValue;
}

//
//void serialEvent() {                                  //if the hardware serial port_0 receives a char
//  inputstring = Serial.readStringUntil(13);           //read the string until we see a <CR>
//  input_string_complete = true;                       //set the flag used to tell if we have received a completed string from the PC 
//}

Source: Windows Questions C++

LEAVE A COMMENT