/// <summary> /// Start I2C for Device /// </summary> /// <param name="devID">Device ID</param> public void SetupI2C(int devID) { try { //I2CFD = I2C.WiringPiI2CSetup(devID); //Do not use this, it totally messed all up and tries to connect to I2C-1 string devicename = "/dev/i2c-0"; I2CFD = I2C.WiringPiI2CSetupInterface(devicename, devID); if (I2CFD != -1) { I2CConnected = true; UpdatePinStates(); Log.Add($"Device {devID.ToString("X2")} succesfully open, filedescriptor is {I2CFD}"); } else { I2CConnected = false; throw new UnauthorizedAccessException($"Failure to open device {devID}"); } } catch (Exception ex) { throw ex; } }