internal static void TestI2C() { II2CBus Bus = new I2CBusPi(); VEML6070 UV = new VEML6070(Bus); Log.SetSingleOutputLevel(Log.Source.SENSORS, Log.Severity.DEBUG); for (int i = 0; i < 50; i++) { UV.UpdateState(); Log.Output(Log.Severity.DEBUG, Log.Source.SENSORS, "UV Reading: " + UV.GetData()); Thread.Sleep(200); } }
internal static void TestI2C() { BBBPinManager.AddMappingGPIO(BBBPin.P8_08, true, Scarlet.IO.ResistorState.PULL_DOWN); BBBPinManager.AddMappingsI2C(BBBPin.P9_24, BBBPin.P9_26); BBBPinManager.ApplyPinSettings(RoverMain.ApplyDevTree); VEML6070 UV = new VEML6070(I2CBBB.I2CBus1); Log.SetSingleOutputLevel(Log.Source.SENSORS, Log.Severity.DEBUG); for (int i = 0; i < 20; i++) { UV.UpdateState(); Log.Output(Log.Severity.DEBUG, Log.Source.SENSORS, "UV Reading: " + UV.GetData()); Thread.Sleep(200); } }
public void Initialize() { this.ADC = new TLV2544(this.SPI0, new DigitalOutPi(16));// { TraceLogging = true }; TLV2544.Configuration Config = TLV2544.DefaultConfig; Config.VoltageRef = TLV2544.VoltageReference.INTERNAL_2V; Config.ConversionClockSrc = TLV2544.ConversionClockSrc.INTERNAL; Config.UseEOCPin = true; //Config.UseLongSample = true; this.ADC.Configure(Config); this.Thermocouple = new MAX31855(this.SPI0, new DigitalOutPi(18)); this.UVLight = new VEML6070(this.I2C1); this.Atmospheric = new BME280(this.I2C1); this.Atmospheric.Configure(); this.Atmospheric.ChangeMode(BME280.Mode.NORMAL); this.AirQuality = new MQ135(this.ADC.Inputs[0], 3300, 6400, 4.6); this.SoilMoisture = new VH400(this.ADC.Inputs[1]); this.TakeReadings = true; }