Can't get output on pin

On an OpenMV M7 board, I detect blobs. Then I want to set a pin high if there are any blobs.

I do that like this

p_out = Pin("P0", Pin.OUT_PP)

and then, later in the code after blob detection (which I can see works in the terminal with the print()-statement) in the looping part of the script:

    if blobs != []:

The raspbarry that the OpenMV board is connected to does not detect any signal except for an occational blip that appears unrelated to the presence of blobs.

I have tested that i can detect by passing power to it from a different source, so the issue must be the OpenMV. Am I doing something wrong?

please use p_out.value=(True) or p_out.value=(False)
also make sure that this is ‘P0’ and not “P0”.
make sure grounds are connected too.
use pullup/down resistors also.

Thank you for your reply.

Connecting gnd removed the random blips.

There is no luck getting a high signal through, though. If I connect the signal wire to 3.3v on the openMV I can see that as a signal proving there is a circuit.

p_out.value=(True) triggers an error as you can see bellow.

Just to be sure… I assume setting p0 to high/true means that the pin that has p0 printed next to it on the board will be set to high, right? There is no BCM/board switching as on raspberry or anything like that, right?

Does following this not work? class Pin – control I/O pins — MicroPython 1.19 documentation

p_out.value=True or p_out.value=False
Remove parentheses

I think that is exactly what I am doing, @kwagyeman

The document you link to says:

You can also use strings:
g = pyb.Pin(‘X1’, pyb.Pin.OUT_PP)

And I do this:

from pyb import Pin
p_out = Pin('P1', Pin.OUT_PP)

Since I only import Pin and not all of pyp, I don’t have to write pyb.Pin, but only Pin.

The switching of the pin that @oramafanis mentions is also there - but that returns the shown error:

Pin.value([value ])

Get or set the digital logic level of the pin:

  • With no argument, return 0 or 1 depending on the logic level of the pin.
  • With value given, set the logic level of the pin. value can be anything that converts to a boolean. If it converts to True, the pin is set high, otherwise it is set low.

It seems to me I am doing this exactly as the doc says I should - why doesn’t it work?


i was from phone and didnt remember
without " = "