private async Task SendDataToAzure() { while (true) { if (SendDataToAzureIoTHub) { sendDeviceTelemetryData(); } await Task.Delay(1000); } }