Search found 4 matches

by mbell
Thu Sep 16, 2021 9:10 am
Forum: Raspberry Pi microcontroller boards
Topic: dynamically set up pin classes
Replies: 4
Views: 2696

Re: dynamically set up pin classes

Thanks for that,

say i wanted to parse a file to create classes that are defined in the file

GP5=ToggleSwitch,"TABLE SWITCH", 5, 0, 1
GP4=LED,"MAIN LIGHT",4,1,1

where ToggleSwitch and LED are objects i want to create.

again maybe I am tryharding.
by mbell
Wed Sep 15, 2021 1:54 pm
Forum: General Discussion and Questions
Topic: Any clever ways to set up pins
Replies: 4
Views: 2230

Re: Any clever ways to set up pins

Ah so you would define all in a separate .py file. I was hoping to try a human readable something like the following: GP5=ToggleSwitch,"TABLE SWITCH", 5, Pin.OUT, Pin.PULL_UP create variable called GP5 that is an instance of ToggleSwitch with the following values as its constructor. maybes im just c...
by mbell
Wed Sep 15, 2021 8:56 am
Forum: General Discussion and Questions
Topic: Any clever ways to set up pins
Replies: 4
Views: 2230

Any clever ways to set up pins

Hi all,

Does anyone know of a clever way to set up pins from a config file ?

Id like to create a generic firmware that is able to load a config file to set up pins with pyb classes.

THanks in advance
by mbell
Tue Sep 14, 2021 3:27 pm
Forum: Raspberry Pi microcontroller boards
Topic: dynamically set up pin classes
Replies: 4
Views: 2696

dynamically set up pin classes

Hi Gang, I would like my PICOs pins to be somewhat dynamically initialised when the PICO loads using some sort of file. To now my idea is to have a config.txt file with something like the following. in the example below the CSV variables represent a class and a setup: GP5=ToggleSwitch,"TABLE SWITCH"...