I am trying to code a flight computer.
The odd think about this error is:
This code block works flawlessly:
class PlaneStatus {
public:
PlaneStatus(double y, double p, double r, double t) {
yaw = y;
pitch = p;
roll = r;
throttle = t;
}// Access specifier
double yaw, pitch, roll, throttle; // Attribute (int variable)
};
void manuer(PlaneStatus ms){
ms.pitch;
}
void setup(){}
void loop(){}
But when I add another function completely irrelevant to that object, an error about the PlaneStatus object occurs.
#include <Servo.h>
#include <Wire.h>
void driveServo(Servo servo, int trin ,int arg){
servo.write(trin+ arg);
}
class PlaneStatus {
public:
PlaneStatus(double y, double p, double r, double t) {
yaw = y;
pitch = p;
roll = r;
throttle = t;
}// Access specifier
double yaw, pitch, roll, throttle; // Attribute (int variable)
};
void manuer(PlaneStatus ms){
ms.pitch;
}
void setup(){}
void loop(){}
And this is the error message
sketch_jul01a:67:13: error: variable or field 'manuer' declared void
void manuer(PlaneStatus ms){
^~~~~~~~~~~
sketch_jul01a:67:13: error: 'PlaneStatus' was not declared in this scope
C:\Users\isatu\AppData\Local\Temp\arduino_modified_sketch_56794\sketch_jul01a.ino:67:13: note: suggested alternative: 'mpuIntStatus'
void manuer(PlaneStatus ms){
^~~~~~~~~~~
Can you guys help me figure out why is this?
Thank you and all input is appreciated
Note: Those codes are reproducible, you can just copy-paste.
For future reference
I got an answer from another forum. The problem is with The Arduino IDE's auto-prototype generation.
This solves the problem.
void manuer(PlaneStatus ms);
void manuer(PlaneStatus ms) {
ms.pitch;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With