Skip to content

Running on a Raspberry Pi 3+ #10

@Miniontoby

Description

@Miniontoby

This issue is only to provide a way to run this on a Raspberry Pi 3+. This may not be added into the source code!

I don't have a Raspberry Pi Pico and I still wanted to be able to try/use this with a normal Raspberry Pi 3+. So I tried to make this code compatible.

Here's how you do it:
Just create a file in your cloned folder named machine.py and paste this code into it:

import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)

class PWMchanged(GPIO.PWM):
    def __init__(self, chan, freq):
        super().__init__(chan, freq)
        self.start(freq)
    def duty(self,dutycycle): self.ChangeDutyCycle(dutycycle/65535)
    def freq(self, value): self.ChangeFrequency(value)
    def deinit(self): self.stop()
    pass

def PWM(pin):
    GPIO.setup(pin, GPIO.OUT) # Just to make sure
    return PWMchanged(pin, 50)

def Pin(pin):
    GPIO.setup(pin, GPIO.OUT)
    return pin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions