unosquare / raspberryio

The Raspberry Pi's IO Functionality in an easy-to-use API for Mono/.NET/C#
https://unosquare.github.io/raspberryio
Other
673 stars 104 forks source link

.Net Core 2.0 on Win 10 IoT Supported? #14

Closed PeteCozens closed 7 years ago

PeteCozens commented 7 years ago

I'm writing a .Net Core 2.0 Console App (not UWP) to control some external devices on a Raspberry Pi 3. Does RaspberryIO support this?

I've added the NuGet package to my console app and added the following code to void main() to turn on a LED on pin 5:

var pin = Pi.Gpio.Pin05; pin.PinMode = GpioPinDriveMode.Output; pin.Write(true);

When stepping over the first line I get a System.TypeInitializationException (The type initializer for 'Unosquare.RaspberryIO.Pi' threw an exception)

System.TypeInitializationException: The type initializer for 'Unosquare.Raspberr yIO.Pi' threw an exception. ---> System.Reflection.TargetInvocationException: Ex ception has been thrown by the target of an invocation. ---> System.PlatformNotS upportedException: This library does not support the platform at Unosquare.RaspberryIO.Gpio.GpioController.Initialize(ControllerMode mode) at Unosquare.RaspberryIO.Gpio.GpioController..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOn ly, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipChec kThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean s kipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at Unosquare.Swan.Abstractions.SingletonBase1.<>c.<.cctor>b__7_0() at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue() at Unosquare.Swan.Abstractions.SingletonBase`1.get_Instance() at Unosquare.RaspberryIO.Pi..cctor() --- End of inner exception stack trace --- at Unosquare.RaspberryIO.Pi.get_Gpio() at Echo.Program.SetLightState(Boolean state) in C:\Software\ParkSmart\Echo\Ec ho\Program.cs:line 34

geoperez commented 7 years ago

Hi, this library is not supported by Windows IoT since we rely on WiringPi and Linux device files.

The support to Win IoT is not yet on schedule.

TylerLeonhardt commented 6 years ago

Just wanted to chime in here and say that the PowerShell team is using this package in:

https://github.com/PowerShell/PowerShell-IoT

😄

It's been awesome so far for our Raspbian PowerShell Core users. It'd be really cool if raspberryio could support Win IoT.

Some tweets about it: https://twitter.com/TylerLeonhardt/status/963520685388701696 https://twitter.com/TylerLeonhardt/status/961052962545004544