Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hatsunea/a533226e31a728ec8d4fc1754b719953 to your computer and use it in GitHub Desktop.
Save hatsunea/a533226e31a728ec8d4fc1754b719953 to your computer and use it in GitHub Desktop.
private static void Loop()
{
while (true)
{
try
{
Console.CursorTop = 0;
WriteLine($"DateTime:{DateTime.UtcNow.AddHours(9):yyyyMMdd HHmmss}");
WriteLine($"Pressure:{Qmp.CalcPressureHectopascals():F} hPa");
WriteLine($"Temperature:{Sht.Temperature.DegreesCelsius:F} C");
WriteLine($"Humidity:{Sht.Humidity.Percent:F} %");
// インターバル
Thread.Sleep(1000);
}
catch (Exception ex)
{
// 自動再接続
Debug.WriteLine(ex.Message);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment