Skip to content

Instantly share code, notes, and snippets.

View theacodes's full-sized avatar
🎛️
Bleep bloop

Stargirl Flowers theacodes

🎛️
Bleep bloop
View GitHub Profile
@theacodes
theacodes / thread_emoji.py
Created December 2, 2023 17:42
Thread emoji
import threading
ANIMALS = list(
"🐶🐱🐭🐹🐰🦊🐻🐼🐨🐯🦁🐮🐷🐽🐸🐵🐔🐧🐦🐤🪿🦆🦉🦇🦇🐺🐗🐴🦄🫎🐝🪱🐛🦋🐌🐞🐜🪰🪲🪳🦟🦗🕷️🕸️🦂🐢🐍🦎🦖🦕🐙🦑🪼🦐🦞🦀🐡🐠🐟🐬🐳🐋🦈🦭🐊🐅🐆🦓🦍🦧🦣🐘🦛🦏🐪🐫🦒🦘🦬🐃🐂🐄🫏🐎🐖🐏🐑🦙🐐🦌🐕🐩🐈🐓🦃🦤🦚🦜🦢🦩🕊️🐇🦝🦨🦡🦫🦦🦥🐁🐀🐿️🦔🐉🐲"
)
ANIMALS_LEFT = []
THREAD_EMOJI = {}
def thread_emoji():
@theacodes
theacodes / main.dart
Created December 29, 2022 16:58
silent-echo-3373
void main() {
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
}
@theacodes
theacodes / main.cpp
Created November 14, 2021 19:41
C++ examples for converting between MIDI notes, frequencies, and Volts/octave
#include <cstdint>
#include <cmath>
/*
Examples for converting between note numbers, frequencies, and Volts/octave.
If you're unfamiliar with MIDI note numbers, they are integers that
correspond to semitones (half steps). For example, MIDI note 12 is
C1 (16.35 Hz) and MIDI note 24 (twelve half steps higher) is C2 (32.70 Hz).
@theacodes
theacodes / main.dart
Created November 27, 2019 19:24
AnimatedContainer with FutureBuilder
FutureBuilder(
future: future,
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
double width;
switch(snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.waiting:
case ConnectionState.active:
width = 0;
break;
@theacodes
theacodes / winterbloom_voltage_out.py
Created October 9, 2019 05:26
A helper library to setting a DAC to direct voltage values
# (c) 2019 Alethea Flowers
# Licensed under the MIT license.
"""A helper library to setting a DAC to direct voltage values.
That is, instead of setting a 16-bit integer value you can set the DAC to a
floating-point voltage value.
This requires information about the real-world DAC output and any output
scaling - this is called **calibration** data.
@theacodes
theacodes / winterbloom_ad5689.py
Last active October 9, 2019 05:26
CircuitPython driver for the AD5689
# (c) 2019 Alethea Flowers
# Licensed under the MIT license.
"""A driver for the Analog Devices AD5689(R) 16-bit Digital to Analog Converter.
AD5689 wiring expectations (TSSOP-16 package):
* 1: AD5689 = Vref, AD5689R = NC (uses internal reference)
* 2: NC
* 3: Analog output A
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,

Keybase proof

I hereby claim:

  • I am theacodes on github.
  • I am theacodes (https://keybase.io/theacodes) on keybase.
  • I have a public key ASAYLG-IxCSWNo0Kdev6Z4K60rWKN3-qmJMPSPJ6H_DXpAo

To claim this, I am signing this object:

Write our robot code in Python on the Raspberry Pi.
We'll use the Arduino as a daughterboard. It'll handle I/O.
Use a serial protocol to communicate between the 2.
Raspberry Pi (Python) <-> USB Serial <-> Arduino (Firmware)
How do we get there?
1. Write a Arduino sketch to act as our firmware. This will receive serial commands and send back data.
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#