Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Like this?

  from time import sleep
  import RPi.GPIO as GPIO
  GPIO.setmode(GPIO.BCM)
  GPIO.setup(2, GPIO.OUT)
  while 1:
       GPIO.output(2, False)
       sleep(2)
       GPIO.output(2, True)
Perhaps I'm not understanding what you want exactly, you seem to know what you're doing.


The problem is in pinmuxing. If you want to change the pins from their default modes, you're in for a world of pain. Systems on a chips (SoCs, basically run everything portable these days) are optimized to the point where different die pins can have different modes (GPIO, LCD framing, USB framing, might all be available, one at a time, on the same pin). Switching between them requires mucking about in the kernel and reconfiguring hardware and is, at least in my experience, incredibly painful.

Also, the sysfs mappings that the easy bindings tend to be written from are very, very slow (like ~3+ orders of magnitude slower than they should be: http://hackaday.com/2013/12/07/speeding-up-beaglebone-black-...).




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: