Skip to content

ST Examples

Raspberry Pi Pico 2W shares its I/O with Raspberry Pi Pico 2. Every channel in IO Mapping is already exposed as a global variable through its DefaultMapping name — IN0IN6, OUT0OUT5, AN0AN2, LED and TEMPERATURE are usable directly in any POU without declaring or mapping them.

PROGRAM PLC_PRG
VAR
blinker : TON;
END_VAR
blinker(IN := NOT blinker.Q, PT := T#500ms);
IF blinker.Q THEN
LED := NOT LED;
END_IF
PROGRAM PLC_PRG
OUT0 := IN0;
OUT1 := IN1;
OUT2 := IN2;
OUT3 := IN3;
OUT4 := IN4;
OUT5 := IN5;

Once the WiFi link is up (see WiFi Configuration), every variable is reachable remotely through CODESYS’s usual channels — OPC UA, Modbus TCP, WebVisu — over the network instead of USB. No extra code is needed:

PROGRAM PLC_PRG
OUT0 := AN0 > 40000;

See Raspberry Pi Pico 2 ST Examples for the temperature-alarm example — it applies identically here.