在Arduino的运行程序时连续运行循环? [英] Continuously run loop while running program on Arduino?

查看:1442
本文介绍了在Arduino的运行程序时连续运行循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于在Arduino的运行循环的问题。我编一个Arduino,使其慢慢变淡的LED,我想补充的程序运行时的闪烁的LED。我可以改变整个程序,并把所有的LED行间闪烁,但我想知道是否有一种方式,它可以单独做呢?有没有可能下的无效安装运行一个循环()的,或运行一个循环,然后移动到下一个循环,同时继续运行的第一个循环?

I have a question about running loops in Arduino. I've programmed an Arduino so that it slowly fades in LEDs and I'd like to add an LED that blinks while the program is running. I could change the whole program and put the LED blinking between all the lines, but I was wondering if there was a way it could be done seperately? Would it be possible to run a loop under void setup(), or to run a loop, and then move on to the next loop, while continuing to run the first loop?

闪烁的灯光当然不是真的很重要,但我只是好奇,如果这是可以做到。

The blinking light is of course not really important, but I was just curious if it could be done.

推荐答案

我建议使用msTimer2库用于这一目的。

I suggest to use the msTimer2 library for this purpose.

http://playground.arduino.cc/Main/MsTimer2

其使用的一个例子也可以在德国的Arduino论坛这里最近的讨论中发现:

An example of its use can also be found in a recent discussion in the German Arduino Forum here:

<一个href=\"http://arduino.cc/forum/index.php?PHPSESSID=cf3a483ed1812def070ebeaae09691c3&topic=146086.msg1100336#msg1100336\" rel=\"nofollow\">http://arduino.cc/forum/index.php?PHPSESSID=cf3a483ed1812def070ebeaae09691c3&topic=146086.msg1100336#msg1100336

您不需要懂德语。只取code和尝试。

You do not need to understand German. Just take the code and try it.

这篇关于在Arduino的运行程序时连续运行循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆