Skip to content

Instantly share code, notes, and snippets.

View gist:6258873
package its.view;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
public class GUIWindow extends JFrame{
private static final long serialVersionUID = 4159491956760989038L;
private static final double VERSION = 0.1;
@kelliott121
kelliott121 / timeslice.ino
Last active Jan 16, 2017
Timeslice Architecture
View timeslice.ino
uint16_t TimeSlice = 0;
uint16_t TimeSlicePrevious = (uint16_t) - 1;
void loop()
{
// Record the beginning of the timeslice
uint32_t startTime = micros();
// Update the current timeslice
TimeSlicePrevious = TimeSlice;
View ControllerServer.py
import serial
from uinput import *
class Controller:
"""docstring for Controller"""
NumButtons = 8
def __init__(self, devName, devKeys):
self.devPath = "/dev/" + devName
@kelliott121
kelliott121 / BluetoothTest.ino
Created May 2, 2017
Test of Controller Firmware for PiGRRL Switch
View BluetoothTest.ino
enum DPad {RIGHT = 2, UP = 3, LEFT = 4, DOWN = 5};
enum Buttons {A = 6, B = 7, X = 8, Y = 9};
void setup() {
// Set the DPad buttons to pullup inputs
pinMode(RIGHT, INPUT_PULLUP);
pinMode(UP, INPUT_PULLUP);
pinMode(LEFT, INPUT_PULLUP);
pinMode(DOWN, INPUT_PULLUP);
View ControllerTestFirmware0.ino
enum DPad {RIGHT = 2, UP = 3, LEFT = 4, DOWN = 5};
enum Buttons {A = 6, B = 7, X = 8, Y = 9};
View ControllerTestFirmware1.ino
// Set the DPad buttons to pullup inputs
pinMode(RIGHT, INPUT_PULLUP);
pinMode(UP, INPUT_PULLUP);
pinMode(LEFT, INPUT_PULLUP);
pinMode(DOWN, INPUT_PULLUP);
// Set the action buttons to pullup inputs
pinMode(A, INPUT_PULLUP);
pinMode(B, INPUT_PULLUP);
pinMode(X, INPUT_PULLUP);
View ControllerTestFirmware2.ino
// Print the Key packet
// DPad
Serial.print("K:");
Serial.print(digitalRead(RIGHT));
Serial.print(digitalRead(UP));
Serial.print(digitalRead(LEFT));
Serial.print(digitalRead(DOWN));
// Action buttons
Serial.print(digitalRead(A));
View ControllerServer0.py
class Controller:
"""docstring for Controller"""
NumButtons = 8
def __init__(self, devName, devKeys):
self.devPath = "/dev/" + devName
try:
print "Connecting to " + self.devPath
self.serial = serial.Serial(self.devPath, 9600, timeout=10)
View ControllerServer1.py
ValidKeys = [ KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
KEY_K, KEY_L, KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T,
KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z,]