Skip to content

Instantly share code, notes, and snippets.

@JasonLS
Created August 28, 2018 20:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JasonLS/10460cfb4b2a269415bd2a238c941806 to your computer and use it in GitHub Desktop.
Save JasonLS/10460cfb4b2a269415bd2a238c941806 to your computer and use it in GitHub Desktop.
C code to use baconbits two 7 segment displays
#include <stdio.h>
#include <unistd.h>
int main() {
FILE * spidev = fopen("/dev/spidev2.1", "wb");
//Left 7 Segment
fwrite("\x40\x00\xc0", 1, 3, spidev);//"0's" are on, "1's" are off
//Right 7 Segment
fwrite("\x40\x01\xc0", 1, 3, spidev);
//You should see the segments look like zeroes.
fflush(spidev);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment