Skip to content

Instantly share code, notes, and snippets.

@ataffanel
ataffanel / fan_control.py
Created Apr 29, 2019
raspberry pi fan control
View fan_control.py
import wiringpi
import time
from subprocess import PIPE, Popen
def init_fan():
wiringpi.pwmSetMode(0) # PWM_MODE_MS = 0
wiringpi.wiringPiSetupGpio()
wiringpi.pinMode(18, 2) # pwm only works on GPIO port 18
@ataffanel
ataffanel / disp_node.py
Created Aug 11, 2017
Simple script analyzing output of a loco positioning node in TWR tag mode, saves the distance measurement in a csv file
View disp_node.py
import serial
import re
nranges = 0
nsuccess = 0
current_range = 0
last_pass = False
csv = open("node_otput.csv", "w")
@ataffanel
ataffanel / test_rssi_cf2.py
Created Apr 4, 2016
Example reading RSSI measurement from Crazyflie 2.0
View test_rssi_cf2.py
# cflib can be installed via 'pip install cflib'
import cflib.drivers.crazyradio as crazyradio
cradio = crazyradio.Crazyradio()
# Connection parameter for the CF2
cradio.set_data_rate(cradio.DR_2MPS)
cradio.set_channel(110)
for _ in range(10000):
@ataffanel
ataffanel / map.html
Created Apr 20, 2015
Simple OSM map view in pyqt using QtWebkit
View map.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<style>
body { padding: 0; margin: 0; }
html, body, #map { height: 100%; }
</style>
</head>