I was busy working on a project (containing many classes) when suddently the arduino became unresponsive
I simplified the project to figure what was causing this
basicaly, one empty C++ class is added to the project
from the moment that class is instanciated staticaly or simply declared as a pointer, the arduino - once programmed - disappear as an usb device
I have to reset it to program it again, here is the main code:
#include "main.h"
Main* main; // this crashes the arduino
//Main main; // this too
int led = 13; // simple test code from examples
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
here is the culprit class:
#ifndef MAIN_H
#define MAIN_H
class Main
{
public:
Main();
};
#endif
and its implementation:
#include "main.h"
Main::Main()
{
}
I tried renaming the class too, just in case of conflict I thought my arduino was fried, I tried with another one, same thing I use sublime text, I noticed the arduino ide was sometimes out of wack, so I had to restart it
this makes no sens at all
can someone confirm this? anything wrong with the code? I feel I miss something really obvious, but I double checked everything
regards
apparently, while renaming the class to Main2 (the cpp and h files too) did not work,
renaming the class as systemCore did work
I really don't have any logical explanation for this on, since the compiler does not complain at all
this is quite insane from an engineer point of view, I mean come on !!!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.