Skip to content

Instantly share code, notes, and snippets.

View Robotto's full-sized avatar
💭
Calibrating Self.ballmerPeak

Mark Moore Robotto

💭
Calibrating Self.ballmerPeak
  • Aarhus Gymnasium
  • Aarhus, DK
  • 03:17 (UTC +02:00)
View GitHub Profile
@Robotto
Robotto / SerialtxFromPythonToArduino.ino
Last active March 18, 2025 08:00
Serial RX in arduino from python (receiving raw bytes) - Plays well with this gist: https://gist.github.com/Robotto/48cdc0eb75ccee3a306866d634f76f77
#include <Servo.h>
const int servoPin = 9;
const unsigned long baudRate = 115200;
Servo myservo;
void setup() {
Serial.begin(baudRate);
myservo.attach(servoPin);
}
@Robotto
Robotto / SerialtxFromPythonToArduino.py
Last active March 17, 2025 13:53
Serial TX from python to arduino (sending raw bytes) - Plays well with this gist: https://gist.github.com/Robotto/55494b012af0c0f9c9d7c048066c9290
import serial #Pakken hedder pyserial
import sys
import glob
import time
def list_ports():
""" Finds all serial ports and returns a list containing them
:raises EnvironmentError:
On unsupported or unknown platforms
/*|----------------------------------------------------------|*/
/*|Connection sketch to eduroam network (WPA/WPA2) Enteprise |*/
/*|Suitable for almost any ESP32 microcontroller with WiFi |*/
/*|Raspberry or Arduino WiFi CAN'T USE THIS LIBRARY!!! |*/
/*|Edited by: Martin Chlebovec (martinius96) |*/
/*|Compilation under 2.0.3 Arduino Core and higher worked |*/
/*|Compilation can be done only using STABLE releases |*/
/*|Dev releases WILL NOT WORK. (Check your Ard. Core .json) |*/
/*|WiFi.begin() have more parameters for PEAP connection |*/
/*|----------------------------------------------------------|*/
@Robotto
Robotto / ESP32_MP3_I2S.ino
Created January 14, 2025 12:11
ESP32_MP3_I2S
/*
Rember to upload LittleFS data from data folder after code upload!
CTRL + SHIFT + P -> "Upload LittleFS ...."
Get the upload plugin for IDE V2.2.1+ from: https://github.com/earlephilhower/arduino-littlefs-upload
*/
#include <Arduino.h>
@Robotto
Robotto / readWrite.py
Created December 17, 2024 09:50
læs fra en fil, skriv til en fil.
def kryptoFakeStuff(msg):
return msg
messages=[]
with open("input.txt", "r") as file:
for line in file:
messages.append(line.strip())
with open("ciphers.txt", "w") as file:
@Robotto
Robotto / esp_ble_throttle.ino
Created September 24, 2024 09:22
ESP32 BLE gamepad with single axis (throttle) - hacked together from examples to this library: https://github.com/lemmingDev/ESP32-BLE-Gamepad/
/*
* Reads a potentiometer on pin 34 and maps the reading to the X axis
*
* Potentiometers can be noisy, so the sketch can take multiple samples to average out the readings
*/
#include <Arduino.h>
#include <BleGamepad.h>
@Robotto
Robotto / pump-o-tron.ino
Created April 29, 2024 11:32
pump-o-tron!
#define N_MEASUREMENTS 32 //Number of analogRead (pressure) measurements to average over
#define MAX_PRESSURE 830
const int pumpPin = 8; //LOW TO RUN, HIGH TO STOP
const int valvePin = 9; //HIGH TO CLOSE, LOW TO OPEN
const int pressurePin = A0;
bool valveState=false;
unsigned long pressureFiltered = 0;
@Robotto
Robotto / garanteretFloat.py
Last active January 24, 2024 11:49
Rekursiv float parser - Funktionen der kalder sig selv, indtil brugeren taster et gyldigt tal...
##REKURSION:
#Definér en funktion som bliver ved med at kalde sig selv, indtil indtastningen er gyldig:
def floatGaranteretRekursiv():
try: ##Prøv at parse brugerens indtastning som float:
kommatal = float(input("Indtast et tal: "))
return kommatal
except: ##Hvis det ikke lykkes, så kalder funktionen sig selv (dvs den bliver ved indtil det lykkes)
print("Ugyldig indtastning, prøv igen...")
return floatGaranteretRekursiv()
@Robotto
Robotto / UDP_RX.ino
Created March 18, 2022 17:15
ESP8266 UDP RX
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
uint8_t state = 0;
String SSID = "IOT";
String PSK = "mrfunkfunk";
@Robotto
Robotto / ESP_UDP_BROADCAST.ino
Last active March 18, 2022 17:09
ESP_UDP_BROADCAST.ino
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <WiFiClient.h>
String SSID = "IOT";
String PSK = "mrfunkfunk";
//UDP stuff:
WiFiUDP Udp;
const unsigned int udpPort = 1337;