Search found 3 matches

by BallardHill
Mon Jul 25, 2022 11:53 pm
Forum: General Discussion and Questions
Topic: Using array contents to set up GPIO Pins
Replies: 4
Views: 6514

Re: Using array contents to set up GPIO Pins

Scruss, in my obsessive manner I'd have defined LEDLeftMost = 2 and continued naming the indices so my code would be readable to forgetful me, or even added a different level of indirection like LED0 = 2, LED1 = 0, etc. I've worked with other developers who found such habits of mine quite annoying ...
by BallardHill
Mon Jul 25, 2022 11:39 pm
Forum: General Discussion and Questions
Topic: Using array contents to set up GPIO Pins
Replies: 4
Views: 6514

Re: Using array contents to set up GPIO Pins

Thanks for your responses! And *I* agree that it's good to know the names of Pins by their usage. I was mostly looking for the technique to iterate through an array in MicroPython, since that will be useful in upcoming code routines. I've bounced all through the MP docs and have not yet unearthed th...
by BallardHill
Mon Jul 25, 2022 6:48 pm
Forum: General Discussion and Questions
Topic: Using array contents to set up GPIO Pins
Replies: 4
Views: 6514

Using array contents to set up GPIO Pins

Would it just be better to make a list of statements than use code such as this: #Setup GPIO Pins from array from machine import Pin #from Array import Array def arr(n=0): Setup = [ [0, Pin_IN, PULL_UP], #p1 [2, Pin_IN, PULL_UP] #p4 ] #Now use array entries to set up GPIO Pins #for contents of array...