[英]Arduino micro - stops working using an empty class (ide v 1.8.9)
当 arduino 突然变得无响应时,我正忙于一个项目(包含许多课程)
我简化了项目以找出造成这种情况的原因
基本上,一个空的 C++ class 被添加到项目中
从 class 静态实例化或简单地声明为指针的那一刻起,arduino - 一旦编程 - 作为 usb 设备消失
我必须重新设置它才能再次编程,这里是主要代码:
#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
}
这是罪魁祸首class:
#ifndef MAIN_H
#define MAIN_H
class Main
{
public:
Main();
};
#endif
及其实施:
#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
这根本没有任何意义
有人可以证实这一点吗? 代码有什么问题吗? 我觉得我错过了一些非常明显的东西,但我仔细检查了一切
问候
显然,在将 class 重命名为 Main2(cpp 和 h 文件)时不起作用,
将 class 重命名为 systemCore 确实有效
我真的对此没有任何合乎逻辑的解释,因为编译器根本没有抱怨
从工程师的角度来看,这太疯狂了,我的意思是来吧!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.