Output state of touch sensor
This block outputs the state of the LEGO MINDSTORMS 9843 Touch Sensor: 1 while pressed, and 0 while released.
If you run a simulation of a model that contains this block without the target hardware, this block outputs zeroes. See Block Produces Zeros or Does Nothing in Simulation.
Open the legonxtlib block library and copy the blocks shown to a new model.
Connect the Touch block to the LCD block, as shown.
Connect the touch sensor to Port 1 on the NXT brick.
Prepare and run the model on the NXT brick.
Observe the state of the touch sensor on the LCD display while you press and release the touch sensor.
Select the NXT sensor port to which the sensor is connected. Avoid assigning multiple devices to the same port. The options are 1, 2, 3, or 4.
Specify how often the block reads sensor values.
Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.