This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-06-28 16:44:32

neelix087
New Scratcher
Registered: 2012-06-23
Posts: 4

Pico Board Button

I want to use the button as a counter. Every time I click the button the counter adds one to the total.

I have tried a few variations but one press adds a random large number to the total. It appeared to be counting the time the button was pressed.

Ideas and help welcome.

Offline

 

#2 2012-06-28 16:49:26

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Pico Board Button

The problem, is speed. The value for button pressed? will be 1 until it is released. Therefore, it will rapidly increase if you hold the button down. One way to deal with the issue is to wait for the button to be up again

forever
repeat until <button pressed>
change [counter v] by [1]
wait until <not<button pressed>>
end
end


I support the Free Software Foundation. Protect our digital rights!

Offline

 

Board footer