Home | pfodApps/pfodDevices | WebStringTemplates | Java/J2EE | Unix | Torches | Superannuation | CRPS Treatment | | About Us
 

Forward Logo (image)      

pfodWeb -- A single web page to
Design, Generated Code, and Control and Plot/Log data from any micro

by Matthew Ford 28th Nov 2026 (originally posted 28th Nov 2026)
© Forward Computing and Control Pty. Ltd. NSW Australia
All rights reserved.

pfodWeb UI Designer and Code Generator for
Non-Arduino Microprocessors

In addition to Arduino boards, pfodWeb Designer supports non-Arduino microprocessors.
STM32, ESP32 (SDK) ESP8266 (SDK), nRF52 (nRF5 SDK), nRF54L (nRF Connect SDK Bare Metal), Raspberry Pi RP2040 / RP2350 (Pico SDK), Microchip SAM and PIC32/16/8, Attiny, NXP Kinetis and MCX (MCUXpresso SDK), Zephy, etc.

Contents

Introduction
Non-Arduino CPP code – Serial – table of completed examples
Creating UI for Pi Pico rp2040
   Using AI Assistants to Design Menus/Dwgs – optional
   Completing the Code - target_stream and target_pfodClock
   Implementing the Logic and I/O access
Minimal C code – Serial


Introduction

See pfodWeb Quick Start for how to get pfodWeb and the pfodParser/pfodParserCPP/pfodParserC libraries installed and running

These tutorials cover pfodWeb Designer usage to create Menus/sub-menus, charts and interactive dwgs :-
Designing menus / sub-menus and charts – uses Arduino UNO. For other designer examples see these tutorals
pfodWeb Dwg Designer GUI Tutorials – designs interactive GUI's, uses Arduino Mega or higher. The simple examples also work with Arduino UNO

Those tutorial target processors that use the Arduino framework, but by choosing either of the two non-Arduino targets you can generate code for non-Arduino microprocessors.

The two non-Arduino targets are:-
Non-Arduino CPP code – Serial and
Minimal C code – Serial

Non-Arduino CPP code – Serial

This Non-Arduino CPP code – Serial target is for use with most modern processors that have a non-trivial amount of flash and ram memory. Such as STM32 and PIC32, etc. The code generated for the Non-Arduino CPP target is designed to run with the pfodParserCPP library which is included in the pfodParserCPP sub-directory of the pfodParser library, pfodParser.zip (or from Github)

The pfodParserCPP library includes a number of examples.

pfodParserCPP/examples
Directory

Platform

target_Stream uses

micros() uses

esp32/OnOff_Serial/

ESP32 (ESP-IDF)

driver/uart.h, the driver's own rx/tx buffers

esp_timer_get_time()

esp32/OnOff_BLE/

ESP32 (ESP-IDF, Bluedroid), over BLE

the Arduino ESP32 core's Nordic UART example (UART.ino) ported to the ESP-IDF Bluedroid GATT server API (NUS), RX from the Bluedroid task into a pfodRingBuffer

esp_timer_get_time()

esp32/OnOff_HTTP/

ESP32 (ESP-IDF), over WiFi as an HTTP server

no target_Stream: pfodWebHandler.cpp (from the pfodParser library's ESP_PicoW_pfodWebServer.cpp) and target_pfodWebServer.cpp, a small server on lwIP's raw TCP API, the same files as rp2040/OnOff_HTTP, each GET /pfodWeb?cmd= run through a pfodStreamString in loop()

esp_timer_get_time()

esp8266/OnOff_Serial/

ESP8266 under ESP8266_RTOS_SDK

driver/uart.h on UART0 (same target_Stream as esp32)

esp_timer_get_time()

stm32/OnOff_Serial/

STM32 (any family)

STM32Cube HAL UART, interrupt driven RX into a pfodRingBuffer

HAL 1 ms SysTick + SysTick->VAL

nrf52/OnOff_Serial/

Nordic nRF52 (nRF5 SDK)

nRF5 SDK app_uart (FIFO buffered UART)

TIMER2 as a free running 1 MHz 32 bit counter

nrf52/OnOff_BLE/

Nordic nRF52 (nRF5 SDK, S132 SoftDevice), over BLE

Nordic's ble_app_uart example BLE code (NUS), RX from the SoftDevice event interrupt into a pfodRingBuffer

TIMER2 as a free running 1 MHz 32 bit counter

nrf54l_bm/OnOff_Serial/

Nordic nRF54L Series, nRF Connect SDK Bare Metal option (no RTOS, low power)

nrfx UARTE driver, RX into a pfodRingBuffer; CPU sleeps between received bytes

GRTC SYSCOUNTER (k_cycle_get_64()), 1 µs, runs in all power modes

nrf54l_bm/OnOff_BLE/

Nordic nRF54L Series, nRF Connect SDK Bare Metal option, S115 SoftDevice, over BLE

Nordic's ble_nus sample BLE code (NUS), RX from the SoftDevice event interrupt into a pfodRingBuffer; CPU sleeps between events

GRTC SYSCOUNTER (k_cycle_get_64()), 1 µs, runs in all power modes

zephyr/OnOff_Serial/

Zephyr RTOS (incl. nRF Connect SDK)

Zephyr interrupt driven UART API (uart_irq_*/uart_fifo_read/uart_poll_out), RX into a pfodRingBuffer

k_uptime_ticks()

rp2040/OnOff_Serial/

Raspberry Pi RP2040 / RP2350 (Pico SDK)

Pico SDK hardware/uart.h, RX interrupt into a pfodRingBuffer

time_us_32(), the 1 MHz system timer

rp2040/OnOff_USB/

Raspberry Pi RP2040 / RP2350 (Pico SDK), over the chip's own USB port

Pico SDK pico_stdio_usb (TinyUSB CDC) driver called directly, TinyUSB's rx FIFO with a one byte look ahead

time_us_32(), the 1 MHz system timer

rp2040/OnOff_BLE/

Raspberry Pi Pico W / Pico 2 W (Pico SDK, BTstack), over BLE

BTstack's Nordic UART example (nordic_spp_le_counter.c, NUS), CYW43 in poll mode so everything runs in the main loop

time_us_32(), the 1 MHz system timer

rp2040/OnOff_HTTP/

Raspberry Pi Pico W / Pico 2 W (Pico SDK, lwIP), over WiFi as an HTTP server

no target_Stream: the same pfodWebHandler.cpp and target_pfodWebServer.cpp as esp32/OnOff_HTTP, each GET /pfodWeb?cmd= run through a pfodStreamString in loop()

time_us_32(), the 1 MHz system timer

sam/OnOff_Serial/

Microchip SAM D21 / D51 / E5x ... Cortex-M (MPLAB Harmony 3)

Harmony 3 SERCOM USART PLIB in Ring buffer mode (MCC generated SERCOMx_USART_Read/Write/...)

Cortex-M SysTick, 1 ms interrupt + SysTick->VAL

kinetis/OnOff_Serial/

NXP Kinetis K (FRDM-K64F), MCUXpresso SDK 2.x

MCUXpresso SDK fsl_uart.h, RX interrupt into a pfodRingBuffer

Cortex-M SysTick, 1 ms interrupt + SysTick->VAL

mcx/OnOff_Serial/

NXP MCX N (FRDM-MCXN947), current MCUXpresso SDK

MCUXpresso SDK fsl_lpuart.h (LP_FLEXCOMM version), RX interrupt into a pfodRingBuffer

Cortex-M SysTick, 1 ms interrupt + SysTick->VAL

pic32/OnOff_Serial/

Microchip PIC32 (MPLAB Harmony 3)

Harmony 3 UART PLIB in Ring buffer mode (MCC generated UARTx_Read/Write/...)

MIPS core timer, accumulated



Each of these follow the same basic pattern. The Pi Pico rp2040 connecting via USB will be used as an example.

Creating UI for Pi Pico rp2040

Every time the Generate Code button is used, the User Interface design is also exported as json files under the menujson sub-directory from which they can be loaded again for modifications or to generated code for a different target. All the above examples use the same user interface design, OnOff_serial_menuJson.zip

Load Design and Generate Code

Open pfodWeb.html, and select the Designer connection and the Non-Arduino CPP code – Serial target. Click Open Designer

Choose Edit existing Menu and Load Design from File and load the OnOff_serial_menuJson.zip. Click on OnOff_Serial to open the editor and click Preview Menu to see a preview of the menu design.

This menu consists of four (4) menu items and menu prompt (at the bottom). The top menu item is an on/off slider. The second item is just a label, “On/Off Menu Item” The third menu item is an interactive dwg with two buttons and a label. The fourth item is another label, “A Dwg Menu Item with 2 buttons”.

Use the back button, bottom left, to go back to the Edit Menu. From there you can edit the menu items, edit the prompt and add new menu items. For details on creating/editing menus see the Designing menus / sub-menus and charts tutorial

The interactive On/Off dwg has limited editing from this menu. For detailed dwg editing, go back to the first menu (shown when Open Designer was clicked) and select Create/Edit Dwg
S
ee pfodWeb Dwg Designer GUI Tutorials.

From there you can edit the three dwgs, the main dwg, LedOnOff, which includes the two button dwgs, LedOn and LedOff. For more details on creating and editing interactive dwg menu items, see pfodWeb Dwg Designer GUI Tutorials.

Using AI Assistants to Design Menus/Dwgs

pfodWeb is also optimized for use with AI assistants.

In the pfodParser library under pfodParser/pfodWeb/docs are three .md files for the AI assistant to consume.
pfodAI-guide.md -- an guide for the AI assistant on how to turn a user's design request in to a UI.
pfodMenu_json-format.md -- an AI guide on how to create valid json definitions for pfod menus.
pfodDwg_json-format.md -- an AI guide on how to create valid json definitions for pfod drawings.

Point the AI at those three files and ask it to read each completely and thendescribe the contents of the UI you want to build.
Tell the AI to pause after each interation and display the design in the pfodWeb Designer preview so you can make your own edits/modification to the UI using pfodWeb's editing capabilities.

While the AI can create the general design, the fine adjustment to make it look just right are often easier done by hand using the preview/edit features of pfodWeb. For changes that effect multiple similar items, use the pfodWeb editor to determine the exact change required and then ask AI to implement it for the all the effected items.

If you use Claude-in-Chrome or similar, your AI can drive the entire iteration from creating the json files to loading them into pfodWeb's designer for you to preview. Ask claude to save the main dwg at each iteration. This gives you a snapshot of the json files of the design at that stage. If you make changes yourself, save the main dwg and point the AI at it to pickup your edits.

Generate the Code

Go back to the Edit Menu screen and click on the Generate Code button. That will write an OnOff_Serial.zip file to your browser's downloads dir. Unzip that to a working directory.

The generated code contains a trivial main.cpp that opens the target_stream, connects the pfodParser to it and gets the mainMenu handler to process the input. The pfodMainMenu.cpp handles the parsed commands. The Dwg_... files server the dwg items. The dwg items are 'registered' with the pfodParser as part of the initialization and the parser routes requests for display and button commands to those dwgs classes before reaching the pfodMainMenu code.

Completing the Code

To complete the code you need to
a) implement the target_stream and target_pfodClock for your micro,
b) implement the logic and I/O access to your task.

Implementing target_stream and target_pfodClock

The target_stream is a sub-class of pfodStream that the pfodParserCPP library uses for all it stream I/O.

The pfodParser/pfodParserCPP/examples directory has a number of example implementations of target_stream and target_pfodClock for a variety of micros:- STM32, ESP32, ESP8266, nRF52, nRF54L, Raspberry Pi RP2040 / RP2350, Microchip SAM and PIC32, NXP Kinetis, MCX and Zephy based micros.

The target_stream.cpp file provides the skeleton of the implementation. You need to implement begin(uint32_t baudRate), read(), write(uint8_t c) and flush(). This file has a target_stream USB connection for the rp2040.

The target_pfodClock provides a micros() timer for use by the pfodParserCPP library for non-blocking delays. This file uses the rp2040's time_us_32() method. There is also an optional yield() method that can be defined to feed your watch dog timer, if your code uses the pfodBufferedStream in blocking mode.

The pfodParser/pfodParserCPP/examples directory also contains examples of target_streams for BLE and HTTP connections for the rp2040 W / 2W

Implementing the Logic and I/O access for your Task

The code generated by the pfodWeb Designer is structured to separate the view from the control and model classes. The pfodWeb Designer generates the view classes, pfodMainMenu.cpp, Dwg_....cpp. (See OnOff_Serial.zip for the classes pfodWeb Designer generates.) The control and logic is implemented in sub-classes of those generated classes. The sub-classes are accessed by redefining the weakly declared get_pfodMainMenu() and get_dwg_...() methods to return the appropriate class. See the bottom of OnOff_USB_App.cpp,

In the rp2040 USB example, all these small sub-classes are defined in OnOff_USB_App.cpp, while the target_Pin files, target_Pin.h and target_Pin.cpp, configure and control the I/O pin. This allows you to reload the json menu/dwg definition, modify the display, re-generate the code and just overwrite the existing files with the newly generated ones, leaving the logic contained in the sub-classes untouched.

Communication between the sub-classes and the views is by means of virtual methods and global variables.

The pfodMainMenu.h defines
virtual void onOffOut_Changed(int value); // onoff -- 'Led is'

while Dwg_LedOn.h and Dwg_LedOff.h define
virtual bool Dwg_LedOn_cmd_c1(... ) // touchZone in Dwg LedOn touched and
virtual bool Dwg_LedOff_cmd_c1(... ) // touchZone in Dwg LedOff touched

These methods are called when the on/off slider changes state or one of the Led On / Off buttons is clicked.

In OnOff_USB_App.cpp these methods are implemented to set/clear the appropriate I/O pin to turn the Led on/off. e.g.

/**
 * Set the menu's On/Off value and drive the output pin to match.
 * @param value 0 for Off, non-zero for On
 */
static void setOutput(int value) {
  onOffOut_var = (value != 0) ? 1 : 0;
  target_PinWrite(onOffOut_var != 0);
}

class pfodMainMenuApp : public pfodMainMenu {
  protected:
    void onOffOut_Changed(int value) override {
      setOutput(value);
    }

. . .

The target_Pin.h and target_Pin.cpp files in these examples provide the link the actual output pin to be turned on/off, initializing the pin for the correct direction and then setting its state.

Minimal C code – Serial

For very small memory microprocessors, like Attiny and Pic8 use the Minimal C code – Serial target and then implement pfodParserStream interface. The Minimal C Code target generates a minimal C based pfodParser, pfodParserC as part of the generated code.

See the Non-Arduino based microprocessors, e.g. PIC, Attiny84/85 etc. tutorial for a complete example.

Conclusion

This page covered using pfodWeb Designer to create user interfaces for non-Arduino based micro-processors, such as, STM, PIC, to display interactive GUI's served by your Arduino board via Serial, BLE, TCP/IP or HTTP. The Serial connection allows any micro to serve its own custom GUI to control its operation and display its measurements.

AndroidTM is a trademark of Google Inc. For use of the Arduino name see http://arduino.cc/en/Main/FAQ


The General Purpose Android/Arduino Control App.
pfodDevice™ and pfodApp™ are trade marks of Forward Computing and Control Pty. Ltd.


Forward home page link (image)

Contact Forward Computing and Control by
©Copyright 1996-2024 Forward Computing and Control Pty. Ltd. ACN 003 669 994