Skip to content

Instantly share code, notes, and snippets.

@ataffanel
ataffanel / fan_control.py
Created April 29, 2019 20:10
raspberry pi fan control
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 August 11, 2017 09:01
Simple script analyzing output of a loco positioning node in TWR tag mode, saves the distance measurement in a csv file
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 April 4, 2016 12:12
Example reading RSSI measurement from Crazyflie 2.0
# 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 April 20, 2015 14:12
Simple OSM map view in pyqt using QtWebkit
<!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>