Skip to content

Method ReadTemperatureAsync

Namespace: Belay.Core.Examples
Assembly: Belay.Core.dll

ReadTemperatureAsync()

Reads a simulated temperature value. Demonstrates [PythonCode] with more complex Python code.

csharp
[Task(TimeoutMs = 3000)]
[PythonCode("\n        import time\n        # Simulate temperature reading with some variation\n        base_temp = 23.5\n        variation = (time.ticks_ms() % 100) / 100.0\n        temperature = base_temp + variation\n        temperature\n    ")]
Task<float> ReadTemperatureAsync()

Returns

Task<float>

The simulated temperature reading.

Released under the Apache License 2.0.