The Snapper

I did a bit of experimenting before I finally decided on my million dollar idea. First, I tried out the Hello World example like a boss. I changed the text and tried it in Hebrew. It doesn’t like Hebrew. Anti-Semitic code.

I hooked up a PIR sensor and had the LED Matrix respond to motion sensing. I adjusted the code so that it worked kind of like a motion sensor nightlight. If there’s motion, it shines. Check it.

I totally rocked the audio visualizer. Skrillex is obviously the best choice for this sort of activity.

Finally, forget the Clapper. I present the Snapper. Snap your lights on. Snap them off.

photo 1

This is what it looks like connected to both the PIR and Mic Amp situation.

Code:

#include <Wire.h>
#include “Adafruit_LEDBackpack.h”
#include “Adafruit_GFX.h”

const int MICpin = A0;
uint8_t micState = LOW;

Adafruit_BicolorMatrix matrix = Adafruit_BicolorMatrix();

void setup() {
pinMode(MICpin, INPUT);
matrix.begin(0x70);
}

static const uint8_t PROGMEM
full_bmp[] =
{ B11111111,
B11111111,
B11111111,
B11111111,
B11111111,
B11111111,
B11111111,
B11111111 },
no_bmp[] =
{ B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000 };

void loop() {
int sense = digitalRead(MICpin);
if(sense == HIGH) {
if(micState == LOW) {
matrix.clear();
matrix.drawBitmap(0, 0, full_bmp, 8, 8, LED_RED);
matrix.writeDisplay();
micState = HIGH;
}
}
int sense2 = digitalRead(MICpin);
if(sense2 == HIGH) {
if(micState == HIGH) {
matrix.clear();
matrix.drawBitmap(0, 0, no_bmp, 8, 8, LED_GREEN);
matrix.writeDisplay();
micState = LOW;
}
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s