-- Leo's gemini proxy

-- Connecting to capsule.adrianhesketh.com:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; charset=utf-8

capsule.adrianhesketh.com


home


Using a 4 digit, 7 segment display with Raspberry Pi and Go


I'm building a burglar alam with my son, using a Raspberry Pi Zero as the micro-controller, and using Go as the programming language.


That's led to me needing a few libraries along the way. Today's library is, the 4 digit, 7 segment display (e.g. part number 3461BS). It can scroll text and display images.


You can grab the code from [0]


[0]


<video src="/2019/10/IMG_2140.mp4" width="540"/>


err := rpio.Open()
if err != nil {
  fmt.Printf("error: %v\n", err)
  os.Exit(1)
}
defer rpio.Close()

// Setup the display.
// Row 1 (top row of pins).
pD1 := rpio.Pin(8) // BCM pin, see https://pinout.xyz
pa := rpio.Pin(7)
pf := rpio.Pin(16)
pD2 := rpio.Pin(20)
pD3 := rpio.Pin(26)
pb := rpio.Pin(19)
// // Row 2 (bottom row of pins).
pe := rpio.Pin(13)
pd := rpio.Pin(6)
pdp := rpio.Pin(5)
pc := rpio.Pin(0)
pg := rpio.Pin(11)
pD4 := rpio.Pin(9)

disp := segment.NewFourDigitSevenSegmentDisplay(pD1, pa, pf, pD2, pD3, pb, pe, pd, pdp, pc, pg, pD4)
disp.Start(context.Background(), "hello")

reader := bufio.NewReader(os.Stdin)

for {
  s, _ := reader.ReadString('\n')
  disp.Update(s)
}

More


Next


Rotating AWS RDS Secrets with AWS Secrets Manager


Previous


A Go Security Journey - Gophercon UK 2019


Home


home

-- Response ended

-- Page fetched on Sat Apr 27 19:53:45 2024