Good Afternoon Everyone, I'm new to programming and having a blast figuring everything out. I have been doing well and didn't need form help until now but I can't seem to figure out this Class stuff. Research is pointing that I haven't declared anything but I thought I did.
I get an error that states: (aggregate 'Potentiometerread Potentiometerobject' has incomplete type and cannot be defined )
#include <Arduino.h>
#include <potentiometer.h>
class Potentiometerread
{
public:
int getpot()
{
int pot = analogRead(0); // Local varable pot
int potmap = map(pot, 0, 1023, 0, 100); // map values 0-100
delay(250);
return (potmap);
} // Close Void getpot
}; // Close Class Potentiometer
my poteniometer.h code below
class Potentiometerread;
int getpot();
aggregate 'Potentiometerread Potentiometerobject' has incomplete type and cannot be defined
blh64:
your .h files needs to declare the function inside your class
Good Afternoon Blh64,
Thank you so much, the code for that issue is now fixed. I will study the change. A new error showed up but let me try to figure that out before I post anything on this topic.
class Potentiometerread {
public:
int getpot();
};// Close Class Potentiometerread
code for potentiometer.cpp
#include <Arduino.h>
#include <potentiometer.h>
int Potentiometerread::getpot()
{
int pot = analogRead(0); // Local varable pot on pin A0
int potmap = map(pot, 0, 1023, 0, 100); // map values 0-100
delay(250);
return (potmap);
} // Close int getpot