Page 1 of 1

NXC buttons help

Posted: 21 Feb 2011, 16:10
by gamemaker99
Hello
I am making a kirby-like platformer for the NXT using the nxt buttons(so everyone can play), but I can't get NXC to recognize two button presses at the same time. Only one is shown as being pressed. I am using ButtonPressed for each button to detect if a certain one is pressed, but if i push two, the NXT will only detect one.

Re: NXC buttons help

Posted: 21 Feb 2011, 16:15
by h-g-t
I can't remember where exactly but in a recent post John Hansen stated that the NXC code applies a mutex to the buttoncall function to specifically avoid reading two buttons at once.

Don't know if you can press two touch sensors at once.

Re: NXC buttons help

Posted: 21 Feb 2011, 17:27
by nxtboyiii
You cannot press the left+ right, or left+center or right+center, but you can press center+exit, left+exit, right+exit, touch+touch(touch is touch sensor), left+touch, right+touch, exit+touch, center+touch, center+touch+touch, left+touch+touch,right+touch+touch, etc.

Re: NXC buttons help

Posted: 21 Feb 2011, 21:22
by afanofosc
And support for sensing multiple button presses at the same time (as described by nxtboyiii) requires the enhanced NBC/NXC firmware. The standard firmware does not support sensing multiple button presses at the same time.

The limitations described by nxtboyiii are due to the hardware design of the NXT buttons.

The reference to acquire and release in ButtonPressed has to do with trying to read button state from two different threads at the same time - not the ability to sense multiple buttons actually pressed at the same time.

John Hansen