查看Noduino Interrupts的源代码
←
Noduino Interrupts
跳转到:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
== Overview == * attachInterrupt() * detachInterrupt() * noInterrupts() --- disable the interrupt * Interrupts() --- enable the interrupt We suggest you to use: * D8 (GPIO4), D9 (GPIO5) * D4 (GPIO13), D5 (GPIO12), D6 (GPIO14) * D2 (GPIO2) <br><br> == Examples == [[文件:RotaryEncoderWaveform.gif]] Use an encoder example: * D8 connect to the channel A to receive the interrupt (rising) * D9 connect to the channel B <source lang=cpp> #include "noduino.h" static int32_t pos = 0; static bool past_b = 0; void do_encoder_a() { past_b = (bool)digitalRead(D9); past_b ? pos++ : pos--; serial_printf("pos = %d\r\n", pos); } void setup() { serial_begin(115200); pinMode(D9, INPUT); attachInterrupt(D8, do_encoder_a, RISING); } void loop() { } </source> You can try the example in noduino-sdk/examples/noduino/encoder <br><br> == Reference == * [[Noduino]] <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br>
返回到
Noduino Interrupts
。
个人工具
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
社区专页
新闻动态
最近更改
随机页面
帮助
工具箱
链入页面
相关更改
特殊页面