-
-
Save hatsunea/503cb91294251385ec4a1b7d85b7945c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void Setup() | |
{ | |
M5Core2.InitializeScreen(); | |
Console.Clear(); | |
Console.ForegroundColor = Color.White; | |
Console.WriteLine("ENV.III Unit test..."); | |
// PORT A (i2C) | |
Qmp = new(M5Core2.GetI2cDevice(0x70)) | |
{ | |
PressureResolution = PressureResolution.High, | |
}; | |
Qmp.SetPowerMode(PowerMode.Force); | |
Sht = new(M5Core2.GetI2cDevice(0x44)) | |
{ | |
Resolution = Resolution.High, | |
}; | |
} | |
private static void Loop() | |
{ | |
Console.ForegroundColor = Color.White; | |
Console.BackgroundColor = Color.Black; | |
while (true) | |
{ | |
try | |
{ | |
Console.CursorTop = 0; | |
Console.CursorLeft = 0; | |
Console.WriteLine($"DateTime:{DateTime.UtcNow:yyyyMMdd HHmmss}"); | |
Console.WriteLine($"Pressure:{Qmp.CalcPressureHectopascals():F} hPa"); | |
Console.WriteLine($"Temperature:{Sht.Temperature.DegreesCelsius:F} C"); | |
Console.WriteLine($"Humidity:{Sht.Humidity.Percent:F} %"); | |
Thread.Sleep(1000); | |
} | |
catch | |
{ } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment