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 — IN0–IN6, OUT0–OUT5, AN0–AN2, LED and TEMPERATURE are usable directly in any POU without declaring or mapping them.
Blink the onboard LED
Section titled “Blink the onboard LED”PROGRAM PLC_PRGVAR blinker : TON;END_VAR
blinker(IN := NOT blinker.Q, PT := T#500ms);IF blinker.Q THEN LED := NOT LED;END_IFDigital pass-through
Section titled “Digital pass-through”PROGRAM PLC_PRGOUT0 := IN0;OUT1 := IN1;OUT2 := IN2;OUT3 := IN3;OUT4 := IN4;OUT5 := IN5;Analog threshold, visible over WiFi
Section titled “Analog threshold, visible over WiFi”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_PRGOUT0 := AN0 > 40000;See Raspberry Pi Pico 2 ST Examples for the temperature-alarm example — it applies identically here.