gpt4 book ai didi

c++ - 如何使用 C 文件中的 esp8266 引脚排列?

转载 作者:行者123 更新时间:2023-11-30 16:31:20 27 4
gpt4 key购买 nike

我有一个非常基本的示例来说明我正在尝试解决的任务。在 arduino.ino 的主循环中,我使用 sample.h 中的定义调​​用 device.c 中的 sample_run() 函数。从这里我试图了解如何使用 device.c 中的 GPIO 引脚。可以使用arduino ide来完成吗?我附上了一些我想要做的示例代码。

arduino.ino

#include "sample.h"
#include "esp8266/sample_init.h"

void setup() {
}

void loop() {
sample_run();
}

样本.h

#ifndef SAMPLE_H
#define SAMPLE_H

#ifdef __cplusplus
extern "C" {
#endif

void sample_run(void);

#ifdef __cplusplus
}
#endif

#endif /* SAMPLE_H */

device.c

#include "sample.h"
void sample_run(void)
{
//I would like to turn on/off led here
}

最佳答案

在 device.c 中:#include "Arduino.h"

为什么使用 .c 文件而不是 .cpp?

关于c++ - 如何使用 C 文件中的 esp8266 引脚排列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50662762/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com