In my program, I need to detect if a touch sensor is activated. Here's some of my code:

var nxt = new Brick<Sensor, Sensor, Sensor, Sensor>("usb");
nxt.Sensor1 = new TouchSensor();

But When I run it, the value always displays as zero. But I discovered that if I go into the "View" menu in the NXT and see the touch sensor value, the program value reads 1. I can't do that. Also, don't tell me to use Bluetooth, or get the EV3, because I can't. I've tried using the code from the Monobrick website, still nothing. I've also asked it in the "robotics" section. Can someone help me?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.