Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Siege
Published © CC0

Cyclorr

It's an addon that looks like a fly with blinkenlights.

BeginnerProtip1 hour73

Story

Read more

Schematics

Schematic

It's a schematic

Code

crazy_eyes.ino

Arduino
I've found that defining a set of my own "random" values provides a better visual than using the random() function.
// for attiny85 @1MHz (internal)

#include <Adafruit_DotStar.h>
#include <SPI.h>

#define NUMPIXELS  4
#define DATAPIN    3
#define CLOCKPIN   4
Adafruit_DotStar strip = Adafruit_DotStar(NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_BRG);

void setup() {
  strip.begin();
  strip.show();
}

uint32_t pattern_a[20] = {
0x01d2c4,
0x5fe95d,
0x3a7c01,
0x8cc94c,
0xd3ec8d,
0x072130,
0x424454,
0x95893f,
0x98733a,
0x037b03,
0x23e402,
0x9bb87d,
0xb553f7,
0xb03341,
0x1eb3ba,
0x66b4ea,
0xd700e5,
0x75e7c5,
0x1de688,
0x8dfeec
//  0xFF0000,
//  0x00FF00,
//  0x0000FF
};

uint32_t pattern_b[20] = {
0xda6480,
0x57f745,
0xf7b059,
0x675733,
0x833706,
0x09ce37,
0xa7fe47,
0x73778a,
0xeabad9,
0xefb073,
0x9014d4,
0xd9c249,
0x41f510,
0x85cf19,
0xe52311,
0x5a7c9f,
0x9846d8,
0xa7cd99,
0xae37a0,
0x90a186
//  0x0000FF,
//  0x00FF00,
//  0xFF0000
};

int pattern_index = 0;
int pattern_count = sizeof(pattern_a);


void loop() {

  strip.setPixelColor(0, pattern_a[pattern_index]);
  strip.setPixelColor(1, pattern_b[pattern_index]);
  strip.setBrightness(64);
  strip.show();
  delay(10);

  pattern_index++;
  if (pattern_index >= pattern_count){
    pattern_index = 0;
  }
}

Credits

Siege
3 projects • 0 followers

Comments