I have the following classes detailed below: (I am programming in Arduino language which is basically C++)
Weight_Tester_main.cpp :
#include "Weight_Tester_main.h"
#include "weightcalc.h"
WeightCalc weight;
int PotPin = A0;
int PotVal = 0;
int ALED = 12;
int BLED = 13;
void setup() {
Serial.begin(9600);
pinMode(ALED, OUTPUT);
pinMode(BLED, OUTPUT);
pinMode(btnPin, INPUT);
Serial.println("Setup complete. Both LEDs have been configured as outputs. The button has been set.");
delay(500);
}
void loop() {
PotVal = analogRead(PotPin);
Serial.println(weight.getHeavier(PotVal));
}
Weight_Tester_main.h:
//-------------------------------------------------------------------
#ifndef __weight_tester_main_H__
#define __weight_tester_main_H__
//-------------------------------------------------------------------
#include <arduino.h>
//-------------------------------------------------------------------
//-------------------------------------------------------------------
void setup();
void loop();
//-------------------------------------------------------------------
//===================================================================
// -> DO NOT WRITE ANYTHING BETWEEN HERE...
// This section is reserved for automated code generation
// This process tries to detect all user-created
// functions in main_sketch.cpp, and inject their
// declarations into this file.
// If you do not want to use this automated process,
// simply delete the lines below, with "&MM_DECLA" text
//===================================================================
//---- DO NOT DELETE THIS LINE -- @MM_DECLA_BEG@---------------------
void loop();
void setup();
//---- DO NOT DELETE THIS LINE -- @MM_DECLA_END@---------------------
// -> ...AND HERE. This space is reserved for automated code generation!
//===================================================================
//-------------------------------------------------------------------
#endif
//-------------------------------------------------------------------
weightcalc.cpp:
#include "weightcalc.h"
int getHeavier (int Value) {
digitalWrite(13,LOW);
digitalWrite(12,LOW);
// Ready to go boolean
boolean readytogo = true;
// Here, we know Value is the Pot's Value which our main program is going to pass to us
// So we check it for a certain value
Value = 512 ? Serial.println("Perfect!") : Serial.println("Not exact, but who cares as long as its between our range.");
if (Value > 500 && Value < 530) {
Serial.println(" We are good to go!");
readytogo = true;
delay(2000);
Serial.println("Please put the objects in each of the containers.");
delay(20000);
}
else {
readytogo = false;
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
}
if (!readytogo) {
Serial.println("Aborting......");
return -1;
}
else {
;
}
int newValue = analogRead(A0);
if (newValue < 500) {
Serial.println ("A is heavier.");
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
return 0;
}
else if (newValue > 530) {
Serial.println("B is heavier.");
digitalWrite(13, HIGH);
digitalWrite(12, LOW);
return 1;
}
else {
Serial.println("They are both about the same weight.");
return 2;
}
}
weightcalc.h:
//-------------------------------------------------------------------
#ifndef __weightcalc_H__
#define __weightcalc_H__
//-------------------------------------------------------------------
#include <arduino.h>
//-------------------------------------------------------------------
//-------------------------------------------------------------------
class WeightCalc{
public:
int getHeavier(int Value);
};
//-------------------------------------------------------------------
//===================================================================
// -> DO NOT WRITE ANYTHING BETWEEN HERE...
// This section is reserved for automated code generation
// This process tries to detect all user-created
// functions in main_sketch.cpp, and inject their
// declarations into this file.
// If you do not want to use this automated process,
// simply delete the lines below, with "&MM_DECLA" text
//===================================================================
//---- DO NOT DELETE THIS LINE -- @MM_DECLA_BEG@---------------------
//---- DO NOT DELETE THIS LINE -- @MM_DECLA_END@---------------------
// -> ...AND HERE. This space is reserved for automated code generation!
//===================================================================
//-------------------------------------------------------------------
#endif
//-------------------------------------------------------------------
And I get the error you see in the title. I am using the MariaMole IDE. I'm sorry this is mostly code but I wanted to show everything so that you can help.