07-08-2011 01:22 PM
Single loop solution for strings:
02-26-2014 04:45 PM
Im trying to generate a random number between -10 and 10 and display a LED to display negative values, an LED for the range of 0 to 5, and an LED for values greater or equal to 5.
02-26-2014 09:54 PM - edited 02-26-2014 09:55 PM
@jr10 wrote:
Im trying to generate a random number between -10 and 10 and display a LED to display negative values, an LED for the range of 0 to 5, and an LED for values greater or equal to 5.
This really should be in its own thread but...
"random number (0-1)", multiply by 20, subtract 10.
Feed the output into a "less than 0" comparison, feed the output of that into an LED.
Feed the output of the subtract 10 into a "greater than" comparison together with "5", feed the output to another LED.
Feed the output of the subtract 10 into an "in range and coerce" together with 0 and 5, feed the output to another LED.