bromagosa / Snap4Arduino

Binding Snap! and Arduino together
http://snap4arduino.rocks
GNU Affero General Public License v3.0
133 stars 85 forks source link

Sync LED blinking #174

Closed DenysZaytsev closed 7 years ago

DenysZaytsev commented 7 years ago

Hi Guys,

Is there a way to make LEDs on different PINs to blink in sync (with 0.5-1 seconds delay)? Those should be triggered by pressing single button. If so - can you help me to do it please?

jguille2 commented 7 years ago

Hi, You can do this in different ways. But sometimes, real world is "worse" than virtual one :angry: ... and you may have different issues and get (maybe not) an imperfect sync (because electronics...).

At first, you have two options: sequencing the actions (and maybe not even see the wait between consecutive actions) or trying to program actions in parallel. First option: seqblink

Second options: parallelblink

And many other options. For example, if there are many leds you can simplify the code ... multiplepins

And more... using lists...

Joan