Skip to content

Instantly share code, notes, and snippets.

#include <Adafruit_NeoPixel.h>
#define PIN 2
#define Pixels 24
#define BG 1
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
@4refr0nt
4refr0nt / IoTmanager.ino
Last active July 21, 2020 13:01
ESP8266 client for IoT Manager (Android app)
/*
IoT Manager mqtt device client https://play.google.com/store/apps/details?id=ru.esp8266.iotmanager
Based on Basic MQTT example with Authentication
PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
- connects to an MQTT server, providing userdescr and password
- publishes config to the topic "/IoTmanager/config/deviceID/"
- subscribes to the topic "/IoTmanager/hello" ("hello" messages from mobile device)
Tested with Arduino IDE 1.6.6 + ESP8266 Community Edition v 2.0.0-stable and PubSubClient library v 1.91.1 https://github.com/Imroy/pubsubclient
ESP8266 Community Edition v 2.0.0-stable have some HTTPS issues. Push notification temporary disabled.
// as showed on youtube
void noise_audio2() {
read_audio();
CRGBPalette16 Pal( pit3 ); // the red one
y[0] += (bands[4] - 10) * 4;
scale_x[0] = 10000 - (bands[0] * 40);
scale_y[0] = scale_x[0];
byte layer = 0;
for (uint8_t i = 0; i < Width; i++) {
uint32_t ioffset = scale_x[layer] * (i - CentreX);
@hsiboy
hsiboy / MultiButton.ino
Created January 30, 2015 09:29
multi button with debounce
#define DEBOUNCE 20 // button debouncer, how many ms to debounce, 5+ ms is usually plenty
// here is where we define the buttons that we'll use. button "1" is the first, button "6" is the 6th, etc
byte buttons[] = {4, 9, 12, A0}; // the analog 0-5 pins are also known as 14-19
// This handy macro lets us determine how big the array up above is, by checking the size
#define NUMBUTTONS sizeof(buttons)
// we will track if a button is just pressed, just released, or 'currently pressed'
volatile byte pressed[NUMBUTTONS], justpressed[NUMBUTTONS], justreleased[NUMBUTTONS];
void setup() {
anonymous
anonymous / airship_projector.ino
Created September 25, 2016 00:53
Small Airship Test Code
#define LED_LATCH 7
#define LED_CLOCK 8
#define LED_DATA 9
byte matrix[64] {
HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, //1
HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, //2
HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, //4
HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, //6
HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, //8
@terrag42
terrag42 / Small Airship Reverse Engineer
Last active September 29, 2016 13:53
Reverse engineering the Small Airship LED DJ party light (8x8 matrix)
// This site could be helpful: http://www.binaryhexconverter.com/binary-to-decimal-converter
#define data_pin 12
#define latch_pin 13
#define clock_pin 14
void setup()
{
int shift = 0;
Serial.begin(9600);
pinMode(data_pin, OUTPUT);
@remcoder
remcoder / game of life with 8x8 bicolor led matrix
Last active September 23, 2016 12:02
I recently got one of those 8x8 LED matrices and I was playing with some Game of Life patterns when I found this pretty repeating pattern. I found it by starting with some random patterns. If you look closely you can see the pattern becoming a mirrored version of itself halfway through. Apparently the pattern doesn't repeat like this on an infin…
/*
I recently got one of those 8x8 LED matrices and I was playing with some Game of Life patterns when I found this pretty repeating pattern. I found it by starting with some random patterns. If you look closely you can see the pattern becoming a mirrored version of itself halfway through. Apparently the pattern doesn't repeat like this on an infinite grid but on this wrapping 8x8 grid it does ;-)
FYI, the LED matrix is a bicolor one (green/red) and has an I2C interface (http://www.adafruit.com/products/902). I'm using the colors as follows:
- newly created cells are green
- cells that are at least 10 generations old are red
- other living cells are yellow (simultaneously green+red)
It's hookup up to my Arduino Uno r3.
/*
YouTube Video Link: https://youtu.be/oCWGiHfL3NY
Schematic: https://goo.gl/photos/wKB94DZT4ECusWmcA
This mushroom Lights project is built using a TCRT5000 infrared LED/transistor pair.
For the infrared LED, a 100ohm resistor is connected in series with +5v and the LED.
A 4.7k resistor connected in series between +5v and the emitter of the transistor.
Analog pin A1 (pin 2 on digispark) is connected to the emitter of the transistor.
I'm assuming the project is switched off at least once every 50 days so the millis() does not overflow back to zero.
*/
const uint8_t MUSHPIN [] = {0,1,4}; //PWM pins on the Digispark. Connect the infrared sensor to pin 2 (=A1)