Skip to content

Instantly share code, notes, and snippets.

santolucito /
Created Jul 24, 2021
Age of Empires 2 TC Idle time calculator
import os
from typing import ItemsView
from construct.core import Switch
from mgz import header, body
from pprint import pprint
tc_building_id = 0
total_time_until_castle_click = 0
View dht11_esp32.ino
// DHT Temperature & Humidity Sensor
// Unified Sensor Library Example
// REQUIRES the following Arduino libraries:
// - DHT Sensor Library:
// - Adafruit Unified Sensor Lib:
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
santolucito / ESP32_UDP_AP.ino
Created Feb 24, 2021
Sending UDP on ESP32 in AP mode
View ESP32_UDP_AP.ino
#include <WebServer.h>
#include <WiFi.h>
#include <WiFiUdp.h>
// the IP of the machine to which you send msgs - this should be the correct IP in most cases (see note in python code)
#define CONSOLE_IP ""
#define CONSOLE_PORT 4210
const char* ssid = "ESP32";
const char* password = "12345678";
WiFiUDP Udp;
santolucito / ESP32.ino
Created Feb 24, 2021
Sending UDP on ESP32 in Station Mode
View ESP32.ino
#include <WebServer.h>
#include <WiFi.h>
#include <WiFiUdp.h>
//set up to connect to an existing network (e.g. mobile hotspot from laptop that will run the python code)
const char* ssid = "ssid";
const char* password = "password";
WiFiUDP Udp;
unsigned int localUdpPort = 4210; // port to listen on
char incomingPacket[255]; // buffer for incoming packets
santolucito /
Created Feb 8, 2021
Sonic Pi + Python + ESP32
this python code will listen for serial messages,
and pass that trigger on to SonicPi (code below) as an OSC message, triggering a sound
from pythonosc import osc_message_builder
from pythonosc import udp_client
import serial
import sys
import time
santolucito / readJoystickSwitch.pde
Created Feb 7, 2021
A simple pair of processing and arduino programs to send data back and forth
View readJoystickSwitch.pde
* Simple Read
* Slightly Modified from the Serial Example provided through the Ardunio IDE
* Read data from the serial port and change the color of a rectangle
* when a switch connected to a Wiring or Arduino board is pressed and released.
* This example works with the Wiring / Arduino program that follows below.
View coms1002-demo.pyde
a = 0.0
def setup():
#size(640, 360, P3D)