Files
xod/docs/tutorial/24-flip-flop/README.md
2018-01-26 15:34:36 +03:00

46 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: Flip-flop
---
# #24. Flip-flop
<div class="ui segment note">
<span class="ui ribbon label">Note</span>
This is a web-version of a tutorial chapter embedded right into the XOD IDE.
To get a better learning experience we recommend to install the
<a href="/downloads/">desktop IDE</a> or start the
<a href="/ide/">browser-based IDE</a>, and youll see the same tutorial there.
</div>
You can control the behavior of many nodes with pulses. A very useful node is
`flip-flop`. It acts like a virtual switch, whose states can be controlled by
pulses.
Lets do a classic experiment: blink the LED.
![Patch](./patch.png)
Each time a pulse arrives at the `TGL` pin, the node toggles the boolean value
on the `MEM` pin from `false` to `true` and vice versa.
## Test circuit
![Circuit](./circuit.fz.png)
[↓ Download as a Fritzing project](./circuit.fzz)
## How-to
1. Assemble the circuit with the LED. Do not forget to specify the desired port
in the `PORT` pin.
2. Set the flashing frequency in seconds using `IVAL`.
3. Upload the patch to the Arduino.
The LED will turn on and off at the frequency you've chosen. Try to control
the flashing speed of the LED with a potentiometer. To do this, connect the
output of a pot node to the `IVAL` pin. Each time a pulse arrives at the `TGL`
pin, the node toggles the boolean value on the `MEM` pin from `false` to `true`
and vice versa.
[Next lesson →](../25-multiple-timelines/)