Counter block


#1

Hi all,

I want to make a simple counter. When I click button, the random function will give a number. If the number >30, then counter should increase.

I mean:
if (randomNumber>30)
{
counter=counter+1;
}

But it does not work. I want to find numbers which bigger than 30.

Anyone have idea?


#2

Hi gungorhilal,

Solution is on my site with Pulse (Square 3/255)
https://neuron.kynox.com/autres/astuces-code

More precisely
https://neuron.kynox.com/autres/astuces-code?view=article&id=54

Just link a button to the Random statement


#3

Hi gungorhilal,

Both the Random block and the Counter block use the same logic: change once (or count once) only when the input status changing from N to Y.

Yes, to achieve your purpose, Crackel has figured out a good workaround.


#4

@Crackel thank you very much, it works !


#5