Ai
8 Star 29 Fork 9

空想实验室技术(深圳)有限公司/nulllab_arduino

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
FastIO.ino 1.21 KB
一键复制 编辑 原始数据 按行查看 历史
nulllab 提交于 2021-12-29 21:43 +08:00 . Fix pwm issue and review fastio api
// =======================================================
// Larduino HSP for LGT8FX8D/P series
// Fast.IO demostration
// =======================================================
// Important note:
// fast_io interface is implemented by macro definition
// Compare to arduino's digital i/o interface, fast_io
// is small and fast.
// But fast_io has some limitations:
// 1. only support digital mode i/o operation;
// 2. fastio DO NOT support avriable as arguments!
// e.g, you can not use fastio as following:
// int led = 10;
// fastioMode(led, OUTPUT);
// but you can use it like this:
// #define led 10
// fastioMode(led, OUTPUT);
// or fastioMode(10, OUTPUT);
// or fastioMode(D10, OUTPUT);
// ========================================================
void setup() {
// put your setup code here, to run once:
fastioMode(D2, INPUT_PULLUP);
fastioMode(D5, OUTPUT);
fastioMode(D6, OUTPUT);
fastioWrite(D5, HIGH);
fastioWrite(D6, LOW);
}
void loop() {
// put your main code here, to run repeatedly:
fastioWrite(D5, HIGH);
fastioToggle(D6);
fastioWrite(D5, LOW);
// stop here while will pull D2 to ground!
while (fastioRead(D2) == LOW);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nulllab/nulllab_arduino.git
git@gitee.com:nulllab/nulllab_arduino.git
nulllab
nulllab_arduino
nulllab_arduino
master

搜索帮助