Skip to content

Instantly share code, notes, and snippets.

@KitWallace
KitWallace / animatedodecahedron.scad
Created January 15, 2013 14:17
animation of dedecahedron construction
module box() {
cube([2,2,1], center = true);
}
module hedron(dihedral,n) {
intersection(){
box();
intersection_for(i=[1:n]) {
rotate([dihedral, 0, 360 / n * i]) box();
}
@KitWallace
KitWallace / octahedron.scad
Created January 15, 2013 14:11
Octahedron by intersection
module box() {
cube([2,2,1], center = true);
}
module octahedron() {
dihedral = 109.47122;
n = 3;
intersection(){
box();
intersection_for(i=[1:n]) {
@KitWallace
KitWallace / dodecahedron.scad
Created January 15, 2013 14:08
Dodecahedron by intersection
dodecahedron by intersectionmodule box() {
cube([2,2,1], center = true);
}
module dodecahedron() {
dihedral = 116.565;
n=5;
intersection(){
box();
intersection_for(i=[1:n]) {
@KitWallace
KitWallace / hw1-frag.xml
Created January 4, 2013 23:48
Part of the R test data hw1_data.csv converted to XML
<table>
<row>
<Ozone>41</Ozone>
<Solar.R>190</Solar.R>
<Wind>7.4</Wind>
<Temp>67</Temp>
<Month>5</Month>
<Day>1</Day>
</row>
<row>
@KitWallace
KitWallace / L1.11a.py
Created September 26, 2012 13:45
Potential due to a current source and sink -
import math
def distance(x=0,y=0,z=0) :
return math.sqrt(x*x + y*y + z*z)
def monopole_potential(Io,sigma,r) :
""" compute the potential in volts at a distance r from a monopole current source
Io current in amp
sigma - conductivity in ohm-1 m-1
r distance in m
@KitWallace
KitWallace / Devantech_CMPS010.py
Created September 24, 2012 14:50
Devantech CMPS010 module V2
from Adafruit_I2C import Adafruit_I2C
# ===========================================================================
# CMPS10 Class
# The CMPS10 board is developed by devantech
# Chris Wallace 2012-09-19
# 2012-09-24 addresses corrected, magnetic and true bearings, @property, dXYZ renamed
# ===========================================================================
class CMPS10(object) :
@KitWallace
KitWallace / truecompass.py
Created September 22, 2012 11:37
Compass with declination correction
#!/usr/bin/python
import time
from Devantech_CMPS10 import CMPS10
compass = CMPS10()
declination = -2.2148
while True :
magnetic_bearing= compass.bearing()
true_bearing = round((magnetic_bearing + declination) % 360,1)
@KitWallace
KitWallace / testcompass.py
Created September 22, 2012 10:51
Test script for the CMPS10 compass module
#!/usr/bin/python
import time
from Devantech_CMPS10 import CMPS10
compass = CMPS10()
while True :
print compass.bearing(), compass.pitch(), compass.roll()
time.sleep(5)
@KitWallace
KitWallace / Devantech_CMPS10.py
Created September 22, 2012 10:42
CMPS10 I2C API
from Adafruit_I2C import Adafruit_I2C
# ===========================================================================
# CMPS10 Class
# The CMPS10 board is developed by devantech
# Chris Wallace 2012-09-19
# ===========================================================================
class CMPS10(object) :
__CMPS10_bearing8 = 0x01
@KitWallace
KitWallace / gpsserial.py
Created September 22, 2012 08:46
Acquiring postion data with a GPS receiver
#!/usr/bin/python
import serial
class Position(object) :
def __init__(self) :
self.latitude = 0.0
self.longitude = 0.0
self.altitude = 0.0
self.courseOverGround = 0.0