Skip to content

Instantly share code, notes, and snippets.

View perigalacticon's full-sized avatar

perigalacticon perigalacticon

View GitHub Profile
@walidamriou
walidamriou / I2CScanner.cpp
Created April 3, 2020 00:23
I2C scanner for Arduino, ESP32, ESP8266 ...
#include <Arduino.h>
#include <Wire.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
while (!Serial);
Serial.println("\nI2C Scanner");
}
@hpwit
hpwit / test fastLedshow32
Last active October 15, 2023 20:18
FastLed.show on the second core esp32
#define FASTLED_SHOW_CORE 0
/ -- Task handles for use in the notifications
static TaskHandle_t FastLEDshowTaskHandle = 0;
static TaskHandle_t userTaskHandle = 0;
void FastLEDshowESP32()
{
if (userTaskHandle == 0) {
const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 200 );
#define FASTLED_ESP8266_NODEMCU_PIN_ORDER
#define FASTLED_ALLOW_INTERRUPTS 0
#include "FastLED.h"
#include <Arduino.h>
#include <ESP8266mDNS.h>
#include <ESP8266WiFi.h>
#include <Thread.h>
#include <ThreadController.h>
#include <WebSocketsServer.h>
@atuline
atuline / inoise8_mover_array
Last active October 1, 2023 07:44
Using FastLED noise function to move pixels.
/* inoise8_mover_array
*
* By: Andrew Tuline
*
* Date: March, 2017
*
* We've used sine waves and counting to move pixels around a strand. In this case, I'm using FastLED Noise to move an array of pixels up and down the strand.
*
* The advantage is that it provides random natural movement without requiring lots of fancy math.
*
@kriegsman
kriegsman / ColorWavesWithPalettes.ino
Created August 19, 2015 01:24
ColorWavesWithPalettes - demo of using cpt-city palettes in FastLED code
#include "FastLED.h"
// ColorWavesWithPalettes
// Animated shifting color waves, with several cross-fading color palettes.
// by Mark Kriegsman, August 2015
//
// Color palettes courtesy of cpt-city and its contributors:
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/
//
// Color palettes converted for FastLED using "PaletteKnife" v1:
@bmccormack
bmccormack / movingAvg.c
Created March 31, 2015 01:05
Moving average example in C
#include <stdio.h>
int movingAvg(int *ptrArrNumbers, long *ptrSum, int pos, int len, int nextNum)
{
//Subtract the oldest number from the prev sum, add the new number
*ptrSum = *ptrSum - ptrArrNumbers[pos] + nextNum;
//Assign the nextNum to the position in the array
ptrArrNumbers[pos] = nextNum;
//return the average
return *ptrSum / len;
@postspectacular
postspectacular / hsv2rgb.ino
Last active February 22, 2024 12:53
Super compact HSV/RGB conversions for Arduino/C
int redPin = 6;
int greenPin = 5;
int bluePin = 9;
float col[3];
float hue = 0.0;
void setup() {
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
@kriegsman
kriegsman / TimedPlaylist.ino
Last active February 12, 2022 19:36
Timed playlist of animations, designed for sequencing and performance.
#include "FastLED.h"
// This sketch shows one way to define a 'timed playlist'
// of animations that automatically rotate on a custom schedule.
//
// A "ResetPlaylist" method is provided so that the playlist can be
// restarted from a custom external trigger, e.g., a button or event.
// For demonstration purposes, the playlist is reset if the
// sketch receives a letter "r" on the serial port.
//