Skip to content

Instantly share code, notes, and snippets.

@plauche
plauche / die.py
Created May 8, 2018 15:40
dice rollin
import random
class Die(object):
def __init__(self):
#initialize to random int
self._value = random.randint(0,6)
def roll_die(self):
#basically a getter function
self._value = random.randint(0,6)
@plauche
plauche / serial.c
Created February 21, 2018 18:43
serial comms
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
/*
* 'open_port()' - Open serial port 1.
*
@plauche
plauche / main.c
Created December 5, 2017 19:42
basic telemetry return datastructure
#define MAX_DATA_LEN 100
#define MAX_STR_LEN 30
typedef union {
int i;
float f;
double d;
} telem_data_unit;
typedef struct {
@plauche
plauche / client.c
Created September 6, 2017 18:39
dbus examples
#include <dbus/dbus.h>
#include <stdio.h>
#include <stdlib.h>
static void check_and_abort(DBusError *error);
static DBusHandlerResult handle_messages(DBusConnection *connection, DBusMessage *message, void *user_data);
int main() {
DBusConnection *connection = NULL;
DBusError error;
@plauche
plauche / parking.py
Created March 4, 2017 19:19
parking lot detection
from SimpleCV import *
img = Image("./parking_full.png")
img = img / 2
img = img.edges(25, 400)
img.save("parking_edge.png")
num_spots = 0
@plauche
plauche / main1.c
Created December 21, 2016 17:44
pocketqube
/*
* KubOS RT
* Copyright (C) 2016 Kubos Corporation
*
* 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
*
@plauche
plauche / main.c
Created December 13, 2016 21:41
telem example
/*
* KubOS RT
* Copyright (C) 2016 Kubos Corporation
*
* 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
*
@plauche
plauche / telem.md
Last active November 7, 2016 20:30
ukub telem overview
            Sensor Board                                                 Logging Board
+-----------------------------------+                        +-----------------------------------+
| +-------+                         |                        |                                   |
| |Sensor1|                         |                        |                                   |
| +---+---+                         |                        |                                   |
|     |                             |                        |                                   |
| +---v---+   +---------+   +-------+                        +-------+   +---------+   +-------+ |
| |Sensor |   |         |   |       |                        |       |   |         |   |       | |
| |Fetcher+--->Telemetry+---> Comms |       CSP/UART         | Comms +--->Telemetry+--->Storage| |
# This is an STM32F4 discovery board with a single STM32F407VGT6 chip.
# http://www.st.com/internet/evalboard/product/252419.jsp
source [find interface/stlink-v2-1.cfg]
transport select hla_swd
# increase working area to 64KB
set WORKAREASIZE 0x10000