11
submitted 1 month ago* (last edited 1 month ago) by TheButtonJustSpins@infosec.pub to c/python@programming.dev

New to CircuitPython, this feels like it should work according to the docs but it prints six Falses. Any ideas?

#!/usr/bin/env python
import board
import digitalio
import time

class body_controller:

  def __init__(self):
    SWDIO = board.D5
    self._reset_pin = digitalio.DigitalInOut(SWDIO)
    print(self._reset_pin.value)
    self._reset_pin.switch_to_output(True)
    print(self._reset_pin.value)

  def turn_on(self):
    print(self._reset_pin.value)
    self._reset_pin.value = False
    print(self._reset_pin.value)
    time.sleep(1)
    print(self._reset_pin.value)
    self._reset_pin.value = True
    print(self._reset_pin.value)

body = body_controller()
time.sleep(1)
body.turn_on()
time.sleep(1)
you are viewing a single comment's thread
view the rest of the comments
[-] TheButtonJustSpins@infosec.pub 6 points 1 month ago

Looks like pin 5 is no good for this; switched to pin 19 and all is well.

this post was submitted on 07 Sep 2024
11 points (100.0% liked)

Python

6325 readers
236 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS