Skip to content

Instantly share code, notes, and snippets.

View Jorgen-VikingGod's full-sized avatar

Juergen Skrotzky Jorgen-VikingGod

View GitHub Profile
@rochal
rochal / plasma.js
Created May 30, 2012 23:07
plasma.js - Creating Plasma Fractal in JavaScript
/***************************************************************************
* Do What THe Fuck You Want To Public Licence 2 *
* *
* JavaScript implementation by Piotr Rochala (http://rocha.la/) *
* Based on C# work of Serge Meunier (http://www.smokycogs.com/) *
* *
* Check this code in action on http://rocha.la/javascript-plasma-fractal *
* *
**************************************************************************/
@octosteve
octosteve / ImperialMarch.ino
Created October 1, 2013 22:19
Imperial march played on an Arduino with a Piezo Element
int speakerPin = 9;
int length = 70;
String notes[] = {"G4","G4", "G4", "D#4/Eb4", "A#4/Bb4", "G4", "D#4/Eb4","A#4/Bb4", "G4", "D5", "D5", "D5", "D#5/Eb5", "A#4/Bb4", "F#4/Gb4", "D#4/Eb4","A#4/Bb4", "G4", "G5","G4","G4","G5","F#5/Gb5", "F5","E5","D#5/Eb5","E5", "rest", "G4", "rest","C#5/Db5","C5","B4","A#4/Bb4","A4","A#4/Bb4", "rest", "D#4/Eb4", "rest", "F#4/Gb4", "D#4/Eb4","A#4/Bb4", "G4" ,"D#4/Eb4","A#4/Bb4", "G4"};
int beats[] = { 8, 8, 8, 6, 2, 8, 6 , 2 ,16 , 8, 8, 8, 6, 2, 8, 6, 2, 16,8,6,2,8,6,2,2, 2, 2,6,2,2,8,6,2,2,2,2,6,2,2,9,6,2,8,6,2,16 };
int tempo = 50;
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
@focalintent
focalintent / GridMaps
Last active March 1, 2023 07:08
Showing off some pixel mapping and rotating
// base GridMap class. Allows from mapping from an X x Y grid of
// T values to an MX x MY grid of T values (where
// MX and MY are greater than X and Y respectively), using linear
// interpolation to fill in the gaps. Optionally allows for rotating
// around the center point. Subclasses should provide an implementation
// for the interpolate method, appropriate to the type of data being mapped
template<int X, int Y, int MX, int MY, class T> class AbstractGridMap {
int revcosval,revsinval;
uint8_t angle;
@StefanPetrick
StefanPetrick / 2animations.ino
Last active August 17, 2023 17:10
Simple example of a video cross fade
#include "FastLED.h"
#define NUM_LEDS 144
// have 3 independent CRGBs - 2 for the sources and one for the output
CRGB leds[NUM_LEDS];
CRGB leds2[NUM_LEDS];
CRGB leds3[NUM_LEDS];
void setup() {
@StefanPetrick
StefanPetrick / circular_matrix.ino
Last active March 25, 2024 04:07
A 2d matrix mapped onto a circular led setup
/*
* A FastLED example showing how to
* map a virtual 2d matrix onto a circular led setup
*
* limitations: works so far only up to 255 leds
*
* written by Stefan Petrick 2016
*/
#include "FastLED.h"
@jherax
jherax / arrayFilterFactory.1.ts
Last active July 18, 2024 15:02
Filters an array of objects with multiple match-criteria.
type FilterOperator = 'AND' | 'OR';
type FiltersBy<T> = {
[K in keyof T]?: (value: T[K]) => boolean;
};
/**
* Factory function that creates a specialized function to filter
* arrays, by validating all filters (AND operator),
* or validating just one of the filters (OR operator).
* @param operator Method to validate all filters: AND, OR
@Jerware
Jerware / matrixEffect.ino
Last active January 16, 2022 19:15
Matrix LED Effect using FastLED
// Matrix effect by Jeremy Williams
// Designed for Game Frame
// http://www.ledseq.com
#include <FastLED.h>
// LED setup
#define kMatrixWidth 16
#define kMatrixHeight 16
#define DATA_PIN 2
@narfdotpl
narfdotpl / README.md
Created July 4, 2017 17:06
Quick note about ESP32 servo test

In this video I used TCP sockets. I have since switched to UDP sockets with no buffering. Results are similarly smooth but servos are more responsive.

I use the following setup:

  • SparkFun ESP32 Thing
  • MG92B servos
  • ESP32 is an access point (creates a wifi network) and a UDP socket server
  • gamepad communicates with the phone over bluetooth
  • phone joins the wifi network and sends data to the UDP socket
  • I need only one-way communication
/*
* Multiplexed SSD1306 Demo
* Copyright © 2018-01-02 tobozo
*
* https://github.com/tobozo
* https://twitter.com/tobozotagada
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the “Software”), to deal in
* the Software without restriction, including without limitation the rights to
@todbot
todbot / tinyusb_hid_ctrl_mousescroll.ino
Last active June 17, 2024 14:05
Use TinyUSB to emulate keyboard + mouse to press Ctrl key and do mouse scroll at the same time. Tested on QT Py M0
/*
tinyusb_hid_ctrl_mousesscroll.ino
2021 @todbot
Modified example from
https://github.com/adafruit/Adafruit_TinyUSB_Arduino/blob/master/examples/HID/hid_composite/hid_composite.ino
This sketch demonstrates multiple report USB HID.
Press button pin will move
- press 'Ctrl' key
- mouse scroll up using scrollwheel