11
submitted 1 week ago* (last edited 1 week 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)
top 1 comments
sorted by: hot top controversial new old
[-] TheButtonJustSpins@infosec.pub 6 points 1 week 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

6219 readers
22 users here now

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

📅 Events

October 2023

November 2023

PastJuly 2023

August 2023

September 2023

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

founded 1 year ago
MODERATORS