Getting started
Build a small console menu before connecting physical hardware. This example uses ConsoleScreen and ConsoleKeyboard; it does not open GPIO pins or serial ports.
Create a project
Install the .NET 10 SDK, then create a console application:
The examples in this guide use the API in the current repository. When working with an unreleased checkout, reference src/Asv.Hal/Asv.Hal.csproj instead of a published package if their APIs differ.
Show a menu
Replace Program.cs with the following complete example:
Run dotnet run in an interactive terminal with at least 34 columns available for the 32-character screen and its border. The first menu item is selected initially. Press Enter to increment the counter, Down Arrow followed by Enter to exit, or Ctrl+C to stop.
Window connects keyboard input to routed events, owns the animation timer and UI scheduler, and renders on a timer tick when a render has been requested. GoTo queues a page change; it does not synchronously attach the page.
Output preview
After three Enter activations, the counter reads Count: 3. This screenshot shows the same control tree rendered once by the gallery sample; its first Rendered: 0 diagnostic is independent of the counter value.

See the Display output gallery for the captured text and commands to reproduce this frame.
Keyboard shortcuts
Key | Behavior in a focused MenuPanel |
|---|---|
Up / Down | Select the previous / next item |
Enter | Give focus to the selected item; a Button invokes its callback |
1–9 | Select and activate the corresponding item when present |
Right | Select the last item |
Left | Select the first item and raise LostFocusEvent |
A Button runs its callback when it receives focus. Avoid setting a button's IsFocused property just to decorate it: doing so activates it.
Lifetime and threading
Keep the window alive while the application is running. Dispose it before releasing the keyboard, subscriptions, controls, or transport objects it uses. The using declarations above unwind in reverse order.
Window disposes its own timer and subscriptions. It does not dispose the supplied keyboard or screen. CompositeScreen and CompositeKeyboard do not own their underlying devices either. Removing a control from a panel or navigating away detaches it; it does not dispose it. Keep reusable pages alive and dispose application-owned controls and subscriptions at shutdown.
Build control trees before attaching them. For changes arriving from background work, use Window.UiTaskFactory; see Controls and events. ConsoleKeyboard uses a background Console.ReadKey loop, so it requires interactive input and cannot serve as an awaited, cancellable input reader.
The Ctrl+C handler sets Cancel and releases the main wait so normal cleanup can run, following the .NET Console.CancelKeyPress contract.
Next steps
Screens and rendering: draw directly or implement an output device.
Keyboard input: consume input or provide your own keyboard.
Controls and events: navigate and update controls.
Remote and serial displays: connect stream-based devices.
GPIO and LEDs: configure pins and play LED patterns.
API source: Window.