Skip to content

Instantly share code, notes, and snippets.

View branw's full-sized avatar
🐠
<º)))><

Brandon W branw

🐠
<º)))><
View GitHub Profile
@branw
branw / due.cpp
Created September 22, 2018 15:44
High-speed data collection with alternating dynamic and static motion
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
// 1.6 MHz is the max frequency of the DAC, so it's easiest
// just to scale everything off of it
const int freq = 1.6e6;
// Duration of a single chirp
const double chirp_duration = 15E-3;
@branw
branw / mega.cpp
Created September 22, 2018 15:15
#include <Arduino.h>
#include <BasicStepperDriver.h>
#define DISABLE_MOTORS false
const int EAR_LEFT_DIR = 48, EAR_LEFT_STEP = 46, EAR_LEFT_ENABLE = 62; // Z
const int EAR_RIGHT_DIR = A1, EAR_RIGHT_STEP = A0, EAR_RIGHT_ENABLE = 38; // X
const int NOSE_TOP_DIR = A7, NOSE_TOP_STEP = A6, NOSE_TOP_ENABLE = A2; // Y
const int NOSE_LEFT_DIR = 34, NOSE_LEFT_STEP = 36, NOSE_LEFT_ENABLE = 30; // E1
t = np.linspace(0, 25, num=10000)
f, (axl, axr) = plt.subplots(1, 2, sharey=True)
newlabel = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
newpos = [t/0.343 for t in newlabel]
axl.grid(linestyle='dashed')
axl.set_xlim([0, 25])
@branw
branw / goose.py
Created September 20, 2018 18:26
import matplotlib.pyplot as plt
from datetime import datetime
import serial
import struct
import math
import os
# Show all packets
VERBOSE = 0
@branw
branw / mega.cpp
Last active September 20, 2018 18:31
#include <Arduino.h>
#include <BasicStepperDriver.h>
const int EAR_DIR = 48, EAR_STEP = 46, EAR_ENABLE = 62; // Z
const int EAR_02_DIR = 28, EAR_02_STEP = 26, EAR_02_ENABLE = 24; // E0
const int NOSE_UP_DIR = 34, NOSE_UP_STEP = 36, NOSE_UP_ENABLE = 30; // E1
const int NOSE_01_DIR = A7, NOSE_01_STEP = A6, NOSE_01_ENABLE = A2; // Y (left)
const int NOSE_02_DIR = A1, NOSE_02_STEP = A0, NOSE_02_ENABLE = 38; // X (right)
const int MOTOR_STEPS = 150;
@branw
branw / due.cpp
Created September 8, 2018 17:37
digitalWrite() but without the overhead
namespace detail {
template<char port, int pin>
constexpr int get_pin() {
// In an ideal world, we could do something like this:
// return digitalPinToPort(pin) == port ? (1 << digitalPinToBitMask(pin)) : 0;
// But alas, C++11's constexpr support is very limited
return (port == 'A' && pin == 69) ? (1 << 0) :
(port == 'A' && pin == 68) ? (1 << 1) :
(port == 'A' && pin == 61) ? (1 << 2) :
(port == 'A' && pin == 60) ? (1 << 3) :
@branw
branw / goose.cpp
Last active September 17, 2018 19:18
#define VERSION_MAJOR 0
#define VERSION_MINOR 1
// 1.6 MHz is the max frequency of the DAC, so it's easiest
// just to scale everything off of it
const int freq = 1.6e6;
// Duration of a single chirp
const double chirp_duration = 15E-3;
classdef BatBot
% BATBOT is a client for NI-based BatBots
%
% PROPERTIES
% - VERSION (const) - Application version number
% - Hostname - Network address of the server
%
% METHODS
% - collectData - Run a task with given parameters and return the
% collected data
@branw
branw / .md
Created August 11, 2016 21:40
0000015667288517_GAME_MASTER (Pokemon GO 0.33.0-2016080700) dumps

Pokemon GO Game Master Client Templates

The following dump was obtained from the cached GetGameMasterClientTemplatesOutProto message of Pokemon GO version 0.33.0-2016080700. The commands were used on a 0000015667288517_GAME_MASTER file extracted from the app's data, using POGOProtos@3682394:

$ xxd  -p 0000015667288517_GAME_MASTER  | tr -d '\n' > 0000015667288517_GAME_MASTER .hex
$ protoc --decode_raw < 0000015667288517_GAME_MASTER  > 0000015667288517_GAME_MASTER .decoded_raw
$ protoc POGOProtos/src/POGOProtos/Networking/Responses/DownloadItemTemplatesResponse.proto --proto_path=POGOProtos/src --decode=POGOProtos.Networking.Responses.DownloadItemTemplatesResponse < 0000015667288517_GAME_MASTER  > 0000015667288517_GAME_MASTER .decoded
@branw
branw / .md
Created August 11, 2016 21:26
0000015638B96885_GAME_MASTER (Pokemon GO 0.31.0-2016073000) dumps

Pokemon GO Game Master Client Templates

The following dump was obtained from the cached GetGameMasterClientTemplatesOutProto message of Pokemon GO version 0.31.0-2016073000. The commands were used on a 0000015638B96885_GAME_MASTER file extracted from the app's data, using POGOProtos@3682394:

$ xxd  -p 0000015638B96885_GAME_MASTER | tr -d '\n' > 0000015638B96885_GAME_MASTER.hex
$ protoc --decode_raw < 0000015638B96885_GAME_MASTER > 0000015638B96885_GAME_MASTER.decoded_raw
$ protoc POGOProtos/src/POGOProtos/Networking/Responses/DownloadItemTemplatesResponse.proto --proto_path=POGOProtos/src --decode=POGOProtos.Networking.Responses.DownloadItemTemplatesResponse < 0000015638B96885_GAME_MASTER > 0000015638B96885_GAME_MASTER.decoded