User defined value?

The ‘buffer’ node is probably what you want for storing a value that can change. You will need additional code to control how it is changed. One alternative would be to use a potentiometer to select temperature. You would need to map the potentiometer range of 0-1 to the temperature range you wish to allow.

If you choose to use ‘buffer’ node, you will need some way for user to set it. This could be up/down buttons to increase/decrease temperature, or a single button to cycle through a range of temperatures.

Here is one coding option for a two-button solution:


The button on the left will increase selected temperature & the button on the right will decrease. You can change add/subtract to be values different than “1”. A cruise-control example would be that many cars will add 2 mph with accel button, but subtract 1 mph with coast button. You could also add/subtract fractional values (like 0.5) if you need to allow greater accuracy.

A down-side of the code above is it will always default to zero on boot/reset. You could change this by expanding select node to specify default value & have a boot node send a pulse to assign that value on startup. An alternate solution would be to put an ‘add’ node between the buffer and watch nodes to add your initial value to buffer output; this option is even more useful if you are using ‘count’ instead of buffer since it always resets to 0 and giving ‘count’ a different start value is very difficult.

There are many other options in XOD for achieving the same general functionality. There was another discussion not too long ago about allowing a button hold to allow continuous change (above example only allows one change per button press; you have to release & press button again for another change). If you are using a single button to rotate through a set range, the ‘count’ node might be a better option than ‘buffer’. Choosing the “best” solution would require knowing what hardware/code surrounds this little part of your program.

1 Like