CodeBridge.Hosting 0.7.0

dotnet add package CodeBridge.Hosting --version 0.7.0
                    
NuGet\Install-Package CodeBridge.Hosting -Version 0.7.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CodeBridge.Hosting" Version="0.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeBridge.Hosting" Version="0.7.0" />
                    
Directory.Packages.props
<PackageReference Include="CodeBridge.Hosting" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CodeBridge.Hosting --version 0.7.0
                    
#r "nuget: CodeBridge.Hosting, 0.7.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CodeBridge.Hosting@0.7.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CodeBridge.Hosting&version=0.7.0
                    
Install as a Cake Addin
#tool nuget:?package=CodeBridge.Hosting&version=0.7.0
                    
Install as a Cake Tool

<p align="center"> <img src="src/CodeBridge.VisualStudio/Assets/CodeBridgePreview.png" alt="CodeBridge" width="220" /> </p>

CodeBridge

CI NuGet Visual Studio 2022+ License: MIT

Control ESP32 and Arduino Uno boards from .NET: in C#, or with a visual flow editor inside Visual Studio. CodeBridge ships a bridge firmware for the board and a .NET SDK that talks to it over USB serial or Wi-Fi, so you write C# instead of embedded C/C++.

Two ways to use it

You are... Use Start here
New to microcontrollers / prefer visual tools CodeBridge Visual Studio Tools (VSIX) Getting started
A .NET developer who wants the SDK directly NuGet packages SDK quick start

NuGet packages

Package Purpose Target
CodeBridge.Abstractions Abstractions (IBoard, ITransport), wire protocol, exceptions. The assembly and namespace are CodeBridge.Core; the NuGet id CodeBridge.Core belongs to another project net8.0
CodeBridge.Transport Serial and TCP/Wi-Fi transports, USB board discovery net8.0 (Windows for USB discovery)
CodeBridge.ESP32 ESP32 board + sensor/actuator drivers net8.0
CodeBridge.Flow Flow document model, validation, runtime net8.0
CodeBridge.Designer.WinForms WinForms Toolbox controls, designer, firmware flashing (ships the firmware) net8.0-windows
dotnet add package CodeBridge.ESP32

SDK quick start

Flash the firmware once (see Getting started), then:

using CodeBridge.Core;
using CodeBridge.Core.Enums;
using CodeBridge.ESP32;

await using var board = await CodeBridgeBuilder
    .Connect()
    .Serial("COM3", baudRate: 115200)   // or .WiFi("192.168.1.50")
    .ToESP32()
    .BuildAsync();

await board.Gpio.SetPinModeAsync(2, PinMode.Output);
await board.Gpio.DigitalWriteAsync(2, PinValue.High);

int raw = await board.Gpio.AnalogReadAsync(34);   // 12-bit ADC value
Console.WriteLine($"ADC34 = {raw}");

More runnable examples are in samples/ (blink, servo, motor/relay, Wi-Fi setup and diagnostics). See the API reference.

Visual Studio extension

  • .cbflow visual flow editor: drag blocks, wire ports, edit properties; follows the active Visual Studio theme. Its toolbar picks the board and port, tests the connection, uploads the firmware and runs the flow on the real board with live per-block status, undo/redo, copy/paste, multi-select and live validation. Hover any block for an animated explanation; five ready-made examples are available from Add > New Item, and Tools > CodeBridge Tour walks you from the first blink to using the SDK from a console app, web API or Windows service.
  • WinForms Toolbox components: CodeBridgeFlowControl and CodeBridgeBoardComponent with Smart Tags to pick a COM port, detect the board and flash the firmware.
  • One-click firmware flashing for ESP32: uses esptool, downloaded on first use over HTTPS and verified by SHA-256. No Python, PlatformIO or Arduino IDE needed. The firmware binaries ship inside CodeBridge.Designer.WinForms.
  • Serial monitor and plotter inside Visual Studio, and code mode: create, build and upload C++ firmware with PlatformIO, with errors in the Error List.
  • Export C#: turn any flow into readable SDK code (a class for your project, or a console Program.cs) from the editor toolbar.
  • Project and item templates, a setup window (Tools > CodeBridge Setup...) and a starter form command.
  • Automatic USB board detection for CP210x, CH340/CH9102, FTDI and official Arduino adapters.

Hardware support

Board Status
ESP32 DevKit (esp32dev) Supported and tested on hardware: GPIO, ADC, PWM, I2C, SPI, 1-Wire, interrupts, sensors, displays, Wi-Fi, one-click firmware
ESP32-S3 DevKit, ESP32-C3 DevKit Firmware builds in CI and one-click flashing is wired up; pin maps follow the Espressif DevKit pinouts. Not yet verified on hardware: please report what you find
Arduino Uno R3 Basic: digital/analog I/O, PWM, servo via the bridge sketch. Flashing needs arduino-cli
Arduino Nano, Arduino Mega 2560 Same sketch (it builds in CI for both); Nano comes in two bootloader flavours (pick "old bootloader" for most clones). Not yet verified on hardware
Any board, no hardware The built-in simulator (.Simulator(), or Simulator in the editor's Port list) runs flows, tests and demos without a cable
STM32, PIC Planned; ToSTM32() exists in the builder but there is no driver yet and building throws NotSupportedException

Drivers included for ESP32: DHT11/22, DS18B20, BME280, BH1750, MPU6050, TCS34725, INA219, HC-SR04, PIR, gas sensors, relays, buzzers, servos, DC/stepper motors, RGB LED, WS2812B NeoPixel, SSD1306 OLED, HD44780 I2C LCD, MQTT, OTA.

Use it from your app

Package What for
CodeBridge.Hosting services.AddCodeBridge(): one shared, thread-safe board connection with reconnection and the simulator, for ASP.NET Core, workers and MAUI
DeviceFleet (in CodeBridge.Hosting) Any number of named boards (USB, Wi-Fi, or boards reached over an ESP-NOW mesh through a gateway that keeps its Wi-Fi) behind one object, with discovery, persistence and per-device reconnection
CodeBridge.Blazor <BoardStatus/>, <PinToggle/>, <PwmSlider/>, <AnalogGauge/>, <SensorChart/> components for a live dashboard
CodeBridge.Mcp An MCP server so an AI assistant can read the board manifest, design and test flows on the simulator and export C# (hardware is opt-in and confirmed per action)
CodeBridge.HomeAssistant Shows the board in Home Assistant through MQTT discovery (switches, lights, sensors) and finds Home Assistant on your network

Samples: Integration.Blazor, Integration.HomeAssistant, Integration.Maui (Android and Windows), plus console, web API and Windows service.

Architecture

Visual Studio        .cbflow editor | WinForms Toolbox | Setup window
SDK (NuGet)          Flow -> Core <- Transport <- ESP32        (Designer.WinForms ties them together)
Board firmware       esp32-bridge (PlatformIO) | arduino-uno-bridge

Security

  • Downloaded tools (esptool) must use HTTPS and match a pinned SHA-256.
  • Firmware flashing runs child processes that are killed (whole tree) on cancel, so serial ports are released.
  • See SECURITY.md to report a vulnerability.

Building from source

./build/pack.ps1 -Vsix      # packs the 5 NuGet packages and builds the VSIX into artifacts/
dotnet test CodeBridge.slnx -c Release

Releasing is described in docs/publishing.md. Contributions are welcome: see CONTRIBUTING.md and the changelog.

License

MIT, see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on CodeBridge.Hosting:

Package Downloads
CodeBridge.Blazor

Blazor components for CodeBridge boards: live status, pin toggles, analog gauges, PWM sliders and sensor charts. Works with the built-in simulator, so you can try it without hardware.

CodeBridge.HomeAssistant

Home Assistant integration for CodeBridge boards: MQTT discovery, switches, lights, sensors and binary sensors appear in Home Assistant by themselves. Finds Home Assistant on your network.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.7.0 0 10/17/2026
0.6.0 36 10/17/2026