I’m trying to do Serial.println() within a class in the Arduino IDE. However, the compiler is saying that Serial was not declared in this scope. Here is the code:
Code in Menu.h
class Menu
{
public:
int options[4];
void test() {
Serial.println("here");
}
private:
};
Code in main file:
#include "Menu.h"
Menu menu;
void setup() {
Serial.begin(9600);
menu.test();
}
void loop() {
}
The right
#includeis probably added automatically by Arduino to your.pde. Try#include <WProgram.h>in the top of yourMenu.h.