Controlling GPIO pins of arduino nicla vision board using openMV IDE

I have just started using micropython running on an Arduino Nicla vision board. I am trying to detect april tags and turn a GPIO pin high. I am able to detect april tags using one of the examples provided. I am using the following code to turn one of the GPIO pin(D3 as per Arduino pinout diagram)

import pyb
import time

ledGreen = pyb.LED(2)

ledRed = pyb.LED(1)
g = pyb.Pin('D3', pyb.Pin.OUT_PP)
print( g.value())
g.value(1)
print( g.value())
while(True):
    ledGreen.on()
    ledRed.off()
    time.sleep(0.5)
    ledGreen.off()
    ledRed.on()
    time.sleep(0.5)

While running the script I can see the LED is changing colour, but measuring the voltage across D3 and GND pin, I a not seeing any voltage. What am I doing wrong, any help is much appreciated. Thanks

Turns out the mapping I was using for the GPIO pins were wrong. If I use pyb.Pin.board.x where x being the main part( I think it is supposed to port) in the Arduino docs pin-out diagram, its working as expected. So for example to turn on GPIO0/D0 I used the following code snippet

import pyb
import time

pin0 = pyb.Pin(pyb.Pin.board.PG12, pyb.Pin.OUT_PP)

pin0.on()
while(True):
    print("starting loop")
    time.sleep(5)
    print("turning high")
    pin0.on()

    time.sleep(5)
    print("turning low")
    pin0.off()

    time.sleep(5)

You should use machine.Pin then you can use pin names:

from machine import Pin
pin = Pin("PG12", Pin.OUT_PP, Pin.PULL_UP))

This is from the examples and the docs.