Skip to content

Instantly share code, notes, and snippets.

@jclement
Created December 26, 2020 23:06
Show Gist options
  • Save jclement/bc5dab3e1c7fa846d9f42c1c32d20c4d to your computer and use it in GitHub Desktop.
Save jclement/bc5dab3e1c7fa846d9f42c1c32d20c4d to your computer and use it in GitHub Desktop.
Silly random 4 segment display thing for Arduino
#include <Arduino.h>
#include <TM1637Display.h>
#define CLK 2
#define DIO 3
TM1637Display display(CLK, DIO);
void setup()
{
display.setBrightness(100);
}
void loop()
{
int i;
uint8_t data[] = {0,0,0,0};
display.setSegments(data);
while(1) {
for(i=0; i<4; i++) {
data[i] ^= (1 << random(7));
}
display.setSegments(data);
delay(50);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment