How to set value of I/O pins

Hello, I am unable to figure out how to light up an LED using a arduino portenta h7 using openMV. I am following this cheatsheet: https://docs.arduino.cc/tutorials/portenta-h7/openmv-cheat-sheet (specifically the I/O portion) and have referred to the pin class documentation: class Pin – control I/O pins — MicroPython 1.20 documentation but I cannot seem to get a simple LED to blink.

import time
from pyb import Pin
        
pin0 = Pin('PI0', Pin.OUT_PP, Pin.PULL_NONE)
while(1):
    pin0.value([1])
    time.sleep_ms(1000)
    pin0.value([0])
    time.sleep_ms(1000)

I am attempting to use pin D7 https://docs.arduino.cc/static/e643e090ab0ef84391b760e52e550d29/ABX00042-pinout.png

import time
from pyb import Pin
        
pin0 = Pin('PI0', Pin.OUT_PP, Pin.PULL_NONE)
while(1):
    pin0.value(1)
    time.sleep_ms(1000)
    pin0.value(0)
    time.sleep_ms(1000)

?

You were passing a tuple to the command which it wouldn’t handle.

I have edited it to your code but it still does not work, is there any other information I can show you that might help?

How you know it doesn’t work? Maybe its working and you cant measure it? Or your output circuit has problem?
Instead of that i use True or False.

I have tested the LED with a standard power supply at 3.3v, I have a multimeter set up at the starting point of pin PI0, as well as multiple portentas I know work. I am able to make stuff like servos and buttons work, but I am unable to get an LED to work.
EDIT: I tried replacing 1 and 0 with True and False but it does not work still

did you tried another pin?
the code is really simple so you must troubleshoot hardware.
did you try with just this code or are you using these few lines inside another ?
did you measure with multimeter without the led?
i will not recomend attaching leds on microcontrollers output without a resistor though.
what led is that? what is the forward voltage?

Tried multiple pins
Ran it only with this code
Yep I tried
Its just a standard LED, I could find the datasheet for the forward voltage but I could be wrong to assume that the voltage out of a high logic would be 3.3V or 5V

I understand the code is really simple which is where my frustration is coming from. I have reason to believe it could be the pin constructor that I have made a mistake with since the portenta H7 cheatsheet says stuff quite different than the Micropython documentation for openMV

what color is it? what type? i nevered used portena but in the docs you sent they say that the high is 3.3V.
A clear white led has around 4 volt Vf.
A red difussed led has only 1.7 Vf.
If you attach a red led without a resitor on output of a microcontroler thois output will be fired up.
Just try without a led . just put a 10k resitor between the pin and the gnd…
Can you measure the 3,3vdc between the pin and gnd?

Will get back to you next time I am at my school lab,currently down with covid so it’ll be a few days :frowning:

1 Like

Am testing what you mentioned

  1. It is a green LED with a Vf of 1.7v
  2. After running the code, I realized that there was about 0.5v going through the pin which I assumed was just stray voltage that was alternating.
  3. Looking into the board more and experiementing, I have found that although the USB-C cable is plugged in(and supposed to be powering the entire circuit according to this: https://support.arduino.cc/hc/en-us/articles/4506554914204-Power-the-Portenta-H7) the power it provided was too little.
  4. For those in the future who might encounter this issue, I have solved it by connecting an external 5v into the Vin pin of the portenta
1 Like