Help! Button flip flop On stable and Off delayed

I’m new to XOD, and I’m in serious difficulty moving from traditional programming to visual (XOD) programming.
Honestly I’m struggling to make even simple patches … Surely, it’s a mental limitation given my mindset.
I’m here to ask for help., hoping for some patch images, to be able to understand how to implement XOD programs:

  1. I didn’t understand how to use xod/gpio/digital-read-pullup with a XOD/common-hardware/button (internal Pullup Arduino).

  2. How to implement a Patch of a Flip flop button with debounce, with this functionality:
    a) Press the button, ON stable until the next press.
    b) Next press the button, OFF delay (delayed switch-off).


hi, n the forum search engine, enter ".xodball"for patches and “.jpg” for images. Most likely, being updated will give you an idea, even if a previous version explodes, it will be functional The libraries have many examples. When you start xod there is a basic tutorial, have you done it yet?

or look

Thanks cesars,
I naturally studied the documentation of XOD.
I repeat, it is my mental limitation to move from text programming, to visual programming

Here is the patch I created for delayed shutdown (I don’t know if it works, I haven’t tested it yet !!!)
I would also like to add the debounce, and set Arduino’s internal pullup resistor as I have always structured my buttons hardware with pin tied to GND.

My mistake is to never read the manuals, I always go to what I need and then go back, I only read all the threads :man_facepalming:

button - D3
delay - 5s
led - D13

use upload and debug with board or simulate( only simple patch)

I think xod/gpio/digital-read-pullup replaces the button node if you want to enable the pull up resister.

Debounce would be placed between the button PRS pin (or xod/gpio/digital-read-pullup SIG pin) and any inputs using the button output.

Having a delay for second button press to turn off, but not the first press to turn on will be a little tricky. I’m thinking using branch to split the signal…maybe something like this:

Note: Image is truncated for me, but you can see full image if you click on it.

FYI: I only negate the input to branch-GATE because it makes the rest of the links much cleaner…you could swap links to T/F pins instead.

NOTE: If you keep pushing the button trying to turn system off, it will keep resetting the delay timer. You could add a gate before the delay-SET and only enable when delay-ACT is false to ignore multiple presses if you don’t want that to happen. Something like:


Alternately, you could have multiple presses while the system is on have the system immediately turn off (if delay-ACT is true and button pressed). Unless it is a very short delay, you better have the delay timer reset also, or it will cause problems if system is turned on again before the delay timer expires.

Can someone in XOD split “The Button” Node into a “Pull up Button” and a “Pull down Button”
I personally learned the button by the Arduino tutorial that uses “Pull Down” so mentally I refuse to accept and use the Pull up method. Not to mention every time I try to use the “pull up” method it doesn’t work, while the “pull down” method works but auto pulses at the start. Or maybe just make that one of the options you can choose for “the button” but leave it as one node. Plus in a mental point of view pushing a button down to complete a circuit to ground makes sense. I imagine in my head sending power to the object i want power to go to when i push the button. Also in a safety perspective it makes sense too. Id rather have a button that is an open circuit basically than one that is connected to voltage already. This way the button can only activate by the physical connection of the button being pushed down and no other way.
The first air brakes on trains worked like this. They would apply air pressure to turn the brakes on. It worked great until they found out that the brakes didn’t work when the air pressure was lost due to a system failure. They changed the air brakes in trains to using air pressure to take the brakes off the train so that in result of a failure the brakes would automatically activate and stop the train.
The pull up method for “the button” reminds me of the first air brakes on trains.

button includes a digital-read-pullup node and debounce (mechanical switch)

the operation is like that

If you don’t want to use pull-up, change button by digital-read and add debounce time


Awesome. Thank you.

I will definitely do this. As in I will definitely be using the digital read with debounce as my button. Cesars do you think you could make that as a node and add it to the xod libraray, so that I could download from the server and then make it part of my library? Honestly just think it would be cooler if I used a Cesars node.

here I left an idea a long time ago, but you must create a folder with your user name, and create the library inside. Do not touch the __lib__/xod folder

here another

I thank all the participants in this post, , real gentlemen.

As for “Pull up Button” and a “Pull down Button” depends on what you want the “default” configuration to be. For example,
say you have a down-stream N-channel MOSFET, and you want it default off. Then you would use a pull-down resistor to ensure this behavior if the input becomes high impedance.
On the other hand, suppose you have an upstream P-channel MOSFET, and want it default off. This time a pull up resistor is required to create this behavior.
There’s also the alternative case where you want a device to be default-on, in which case the above two cases would be reversed (pull-up for the N-channel MOSFET, pull-down for the P-channel MOSFET).

A few other considerations:

I2C lines specify pull-up resistors because devices are “expected” to have an open-drain to ground, and thus need some way to raise the line potential.
Analog comparators are usually configured as open-drain devices, and thus also need pull up resistors to get a high potential output.
You may draw more current using pullup/pulldown resistors, depending on what’s hooked to the input/output.
Either configuration could works equally well in your application (i.e. there’s no significant advantage one way or the other).

And any number of very application-specific reasons why one configuration may be preferred.

Moreover we have the possibility to use the hardware made available, I refer to the internal pullup resistors of which the Arduino boards are equipped, with the advantage of simplifying the external circuit to Arduino, especially when we have to limit the size of the hardware part. This also applies to software debounce, compared to hardware.

One of my requests for help is:
how can I enable Arduino internal resistors?
In text programming it is simply enough:

void setup() {

pinMode(buttonPin, INPUT_PULLUP);



void setup() {

pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, HIGH);



thanks very much!!!

Perfect !!! :slightly_smiling_face:
I looked closely at the xod/common-hardware/button node.