I am using collision sensor with VS2017, c# and windows iot Core.
I create a small app to check the sensor but when I try, I received always 1 value (no related with a collision o vibration) rarely 0
Can we see the app you created? Â What driver libraries do you have installed?
Most of us here use Raspbian for Robots, plain-vanilla Raspbian with the Dexter libraries installed, or ROS, (Robot Operating System) with the Dexter libraries installed - our abilities to help with Windows IoT Core may be very limited, but we’ll try!
thanks a lot for your message. Here the piece of code that I used:
IGrovePi _collision;
_collision = DeviceFactory.Build.GrovePi();
_collision.PinMode(Pin.DigitalPin2, PinMode.Input);
//Get Value from sensor
message.Collision = _collision.DigitalRead(Pin.DigitalPin2);
The library that I use is GrovePi library for Windows IoT v. 1.0.10.
I decided to use c# because I am preparing a prototype to connect with Azure… and send information to D365 CRM and on PowerBI.
Though I know little about c#, shouldn’t you instantiate a copy of the distance sensor class?  There may be a specific protocol for accessing that data, maybe it’s i2c? I don’t know.
Can you provide a link to the specific Seed sensor module used - on their website would be best.  This way we can look it up and see what’s happening.
Caveat: I know little to nothing about c# and Windows IoT - I haven’t had the chance to mess with them yet - but I am willing to try to help you troubleshoot it.
Sigh,
I can understand why you’re using M$ solutions, but it might be easier to use the methods and libraries Seed provides for the Ardunio.
One thing I can suggest is - if they have sample code for the Pi, or the Arduino - try it with a “native” system using their supplied “native” code to verify if it works or not.  Though it’s unlikely, people have  received defective parts - and you might be fighting with a part that doesn’t work.  Verify it works first.
I’ll take another look at this later, but right now you need to verify that your sensor works properly.
Can you find another way of implementing it, maybe in Raspbian for Robots, (on a different SD card, for testing), and try it there? Â Those of us here are more familiar with DexterOS or Raspbian for Robots than Windows IoT. Â Try it that way and see what happens.
Once you get it working in R4R, you can take the knowledge learned and (hopefully!) apply it to your IoT programming.