Skip to content

Method ExecuteCode

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

ExecuteCode(Stream, string, CancellationToken)

Executes Python code on a MicroPython device using Raw REPL protocol.

csharp
public static Task<string> ExecuteCode(Stream stream, string pythonCode, CancellationToken cancellationToken = default)

Parameters

stream Stream

The communication stream to the device.

pythonCode string

The Python code to execute.

cancellationToken CancellationToken

Cancellation token for the operation.

Returns

Task<string>

The output from the device.

Exceptions

DeviceException

Thrown when communication or execution fails.

Released under the Apache License 2.0.