I am one of those “never quite got the hang of electronics” kids. Sure, I built myself a crystal radio. Got that drugstore prescription printer to work with my TRS-80 Model I. And I’ve wired up my share of connectors and cables. But soldering was always a roadblock. And don’t get me started on decrypting the coloured bands on resistors. It’s not that any of this was particularly impenetrable; it’s just that I never took the time, perhaps because sticking to software allowed me to do much more delightful things. But, now I’ve got a Raspberry Pi, and we’re in the Internet of Things era, so the least I can do is get some LEDs turning on and off with Python.

I used this tutorial as the basis for my coding – I just stripped out the IMAP-checking bits; the code looks like this:

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GREEN_LED = 18
RED_LED = 23
GPIO.setup(GREEN_LED, GPIO.OUT)
GPIO.setup(RED_LED, GPIO.OUT)
GPIO.output(GREEN_LED, True)
GPIO.output(RED_LED, True)

Can a “are we getting more than 100% of our electricity from the wind” alert system be too far behind?

Peter Rukavina

Comments

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • Allowed HTML tags: <b> <i> <em> <strong> <blockquote> <code> <ul> <ol> <li>
  • Lines and paragraphs break automatically.

About This Blog

Photo of Peter RukavinaI am . I am a writer, letterpress printer, and a curious person.

To learn more about me, read my /now, look at my bio, listen to audio I’ve posted, read presentations and speeches I’ve written, see things I’ve favourited elsewhere, or get in touch (peter@rukavina.net is the quickest way).

I have been writing here since May 1999: you can explore the 25+ years of blog posts in the archive.

You can subscribe to an RSS feed of posts, an RSS feed of comments, an RSS feed of favourites elsewhere, or a podcast RSS feed that just contains audio posts. You can also receive a daily digests of posts by email. I also publish an OPML blogroll.

InstagramYouTubeVimeoORCIDOpenStreetMapInternet ArchivePEI.artDrupalGithub.