Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
first steps with python3
#2
what does the miflora code look like?

The second module can be written like:
import RPi.GPIO as GPIO


class Gpio:
    def __init__(self):
        GPIO.setmode(GPIO.BCM)  # set board mode to Broadcom

    def gpio_setup(self, pins):
        for pin in pins:
            GPIO.setup(pin, GPIO.OUT)

    def gpio_out(selfself, pins):
        for pin in pins:
            GPIO.output(pin, 1)

def main(self):
    gpio = Gpio()
    setup_seq = [27, 22, 23, 24, 25]
    output_seq = [17, 27, 22, 23, 24, 25]
    gpio.gpio_setup(setup_seq)
    gpio.gpio_out(output_seq)

if __name__ == '__main__':
    main()
Reply


Messages In This Thread
first steps with python3 - by hunnimonstr - Jul-03-2017, 11:27 AM
RE: first steps with python3 - by Larz60+ - Jul-03-2017, 12:19 PM
RE: first steps with python3 - by hunnimonstr - Jul-03-2017, 02:24 PM
RE: first steps with python3 - by hunnimonstr - Jul-03-2017, 01:08 PM
RE: first steps with python3 - by nilamo - Jul-03-2017, 03:05 PM
RE: first steps with python3 - by hunnimonstr - Jul-03-2017, 08:49 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Thumbs Up Sorting Steps MoreMoney 19 1,403 Mar-31-2024, 10:59 AM
Last Post: Pedroski55
  Next steps for using API data Rebster 6 2,767 Oct-10-2020, 05:35 PM
Last Post: perfringo
  Keep Toggle View through Slider Steps yourboyjoe 1 1,777 Aug-10-2020, 07:32 PM
Last Post: Yoriz
  Files to store configuration and steps for a industrial process control application Danieru 1 1,888 Aug-03-2020, 05:43 PM
Last Post: buran
  Gnuradio python3 is not compatible python3 xmlrpc library How Can I Fix İt ? muratoznnnn 3 5,119 Nov-07-2019, 05:47 PM
Last Post: DeaD_EyE
  Pexpect baby steps slouw 9 8,274 May-23-2019, 10:21 AM
Last Post: heiner55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020