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.Connection.Open(); nxt.Sensor1 = new TouchSensor(); nxt.Sensor1.Reset(false); nxt.Sensor1.Initialize(); Console.WriteLine(nxt.Sensor1.ReadAsString());
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?