Initialising GPIO’s in the Hal file or boot.Pty file?

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
HarryOz
Posts: 18
Joined: Thu May 19, 2016 6:02 am

Initialising GPIO’s in the Hal file or boot.Pty file?

Post by HarryOz » Sat Oct 24, 2020 1:33 pm

Are there any examples of how to set pins as outputs and then configure them to low or high.

I would certain pins on the STM32 to be set as outputs and set low on startup.

Any help is appreciated.
Harry


Sent from my iPhone using Tapatalk

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Initialising GPIO’s in the Hal file or boot.Pty file?

Post by dhylands » Sat Oct 24, 2020 2:58 pm

When your board resets all of the pins are configured as inputs.

You can configure them as outputs using the first example here: http://docs.micropython.org/en/latest/p ... s-and-gpio

If you need to control the value of your pin before your code gets control then you’ll need to use something like an external pull-up or pull-down resistor.

Post Reply