Skip to content

Instantly share code, notes, and snippets.

View todocono's full-sized avatar
🤖
Flow?

Rodolfo todocono

🤖
Flow?
View GitHub Profile
/**
* This sketch demonstrates how to use the BeatDetect object in FREQ_ENERGY mode.<br />
* You can use <code>isKick</code>, <code>isSnare</code>, </code>isHat</code>, <code>isRange</code>,
* and <code>isOnset(int)</code> to track whatever kind of beats you are looking to track, they will report
* true or false based on the state of the analysis. To "tick" the analysis you must call <code>detect</code>
* with successive buffers of audio. You can do this inside of <code>draw</code>, but you are likely to miss some
* audio buffers if you do this. The sketch implements an <code>AudioListener</code> called <code>BeatListener</code>
* so that it can call <code>detect</code> on every buffer of audio processed by the system without repeating a buffer
* or missing one.
* <p>
@todocono
todocono / solar-panel.ino
Last active October 12, 2017 03:37
This is a mesh of code examples from Arduino Servo and AnalogInOutSerial
/*
Solar code example
Example 7
Introduction to Robotics
by Rodolfo Cossovich at New York University Shanghai
Description: Using and LDR to move a servo to simulate a
solar panel tracking the sun.
ArrayList<Weird> w = new ArrayList<Weird>();
int n =round(random(1,50)); //how many shapes to show
void setup() {
size(640, 480);
noStroke();
for (int i=0; i<n; i++) {
w.add(new Weird( round(random(200)), round(random(4,8)))) ;
float c = 1;
int direction = 1;
int qty = 10;
float[] posX = new float[qty];
float[] posY = new float[qty];
float[] speedX = new float[qty];
float[] speedY = new float[qty];
float[] size = new float[qty];
import shlex, subprocess, msvcrt, time, sys
# input("Press any key to trigger your signal...")
char = 0
print('Press any key to continue')
while not char:
char = msvcrt.getch()
// ball bouncing 1
float x, y;
int size;
float speedX;
float speedY;
color c;
// ball bouncing 1
float x2, y2;
int size2;
class Ball {
float x, y;
int size;
float speedX;
float speedY;
color c;
Ball(int s) { //construct the ball
x = random(width);
@todocono
todocono / esp32-ap-rainbow.ino
Created June 30, 2019 05:48
esp32-ap-rainbow
/*********
Rui Santos
Complete project details at https://randomnerdtutorials.com
Added rainbow function
*********/
#include <FastLED.h>
#define LED_PIN 32
#define NUM_LEDS 64
int x = 50;
// int condition = 100; I changed this
int condition = 10;
void setup() {
size(600, 600);
background(255, 255, 255);
strokeWeight(25);
// frameRate (70); I commented this... why would you set it?
colorMode(HSB, 100);
int s1 = 20;
int s2 = 20;
float x = 100;
float y = 100;
float spX = random(1, 10);
float spY = random(1, 10);
color c = color(0,0,0);
void setup() {
size(600, 800);