Skip to content

Instantly share code, notes, and snippets.

View turbinenreiter's full-sized avatar

Sebastian Plamauer turbinenreiter

View GitHub Profile
@turbinenreiter
turbinenreiter / read_sensor_store_EEPROM
Last active December 18, 2015 13:09
This Arduino-sketch reads sensor data from the MPU6050 and stores it in the EEPROM.
#include <EEPROM.h>
#include <MPU6050.h>
#include <I2Cdev.h>
#include <Wire.h>
MPU6050 accelgyro;
int k = 0;
int n = 1025;
int ax, ay, az;
@turbinenreiter
turbinenreiter / read_EEPROM
Created June 15, 2013 14:34
This Arduino-sketch reads data from the EEPROM and prints it to the Serial Monitor.
#include <EEPROM.h>
int m = 0;
int n = 0;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
@turbinenreiter
turbinenreiter / error_propagation
Last active December 18, 2015 13:09
A small script to show the error propagation of simple integration.
import numpy as np
from scipy import integrate as i
from pylab import *
t = np.arange(0,100,1)
acc = np.empty(100); acc.fill(10)
acc_error = acc + 1
velo = i.cumtrapz(acc, t)
velo_error = i.cumtrapz(acc_error, t)
t = t[0:99]
@turbinenreiter
turbinenreiter / data
Created June 15, 2013 14:37
Acceleration data in x-direction, read from the EEPROM, sensed with the MPU6050
98
98
98
98
98
98
98
98
98
98
"""
Micro Python driver for SD cards using SPI bus.
Requires an SPI bus and a CS pin. Provides readblocks and writeblocks
methods so the device can be mounted as a filesystem.
Example usage on pyboard:
import pyb, sdcard, os
sd = sdcard.SDCard(pyb.SPI(1), pyb.Pin.board.X5)
import time
class RangeSensor:
def __init__(self):
pass
def make_generator(self):
t_end = time.time() + 0.1
# tell sensor to start measurement
@turbinenreiter
turbinenreiter / visualization
Created June 15, 2013 14:39
Python script to visualize the data from the MPU6050.
import numpy as np
from pylab import *
acc = []
with open('data') as f:
data = f.readlines()
for value in data:
value_acc = ((int(value))-128)/30.0
+ BOARD=stm32f4_disco
+ export ZEPHYR_BASE=/home/plam/Projects/zephyr
+ ZEPHYR_BASE=/home/plam/Projects/zephyr
+ '[' /home/plam/Projects/zephyr == PLEASE_SET_ZEPHYR_BASE ']'
+++ dirname build.sh
++ cd .
++ pwd
+ DIR=/home/plam/Projects/kotlin-native/samples/zephyr
+ source /home/plam/Projects/kotlin-native/samples/zephyr/../konan.sh
++ '[' -z '' ']'
This file has been truncated, but you can view the full file.
warning: IMPORTANT: the library format is unstable now. It can change with any new git commit without warning!
package platform.zephyr.stm32f4_disco {
class ADC_AnalogWDGConfTypeDef (rawPtr: NativePtr) : CStructVar {
var Channel: Int
var HighThreshold: Int
var ITMode: Int
var LowThreshold: Int
var WatchdogMode: Int
var WatchdogNumber: Int
companion object : Type
#lang racket
(require markdown)
(require web-server/servlet)
(provide/contract (start (request? . -> . response?)))
(define (article-fnames path-to-articles)
(directory-list (string->path path-to-articles)))
(define (article-paths path-to-articles article-fnames)