Hey!
I'm new to this whole NXT thing, but not new to C programming, and I was wondering if anyone knows the capabilities of the push button, would I be able to use it as a toggle switch, and if so, does ROBOTC have a function that deals with that or should I be writting my own? I'm used to binary toggleing, so I may have some questions on how to make it un binary.
Thanks

The push button that comes with the NXT is a simple contact switch on the inside, and only returns boolean values. The sensor is a little deceiving, It does look like it could be a toggle switch. Its big and the end can pivot somewhat to allow more versatile ways to push it.

You can read the sensor multiple ways however, you can set it up as a boolean, returning a 1 OR 0, or as a passive sensor and get values in between 0% and 100%. Another way people don't take much notice to is PulseCount, which reads how many times the sensor is pressed and released, not the current state of the switch.

Here are some example pieces that show how to change the mode of a sensor
SensorMode[S1] = modeBoolean;
SensorMode[S1] = modePercentage;
SensorMode[S1] = modePulseCount;

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum