Skip to content

Instantly share code, notes, and snippets.

View wattnotions's full-sized avatar

wattnotions

  • In a dark room somewhere
View GitHub Profile
@wattnotions
wattnotions / lcd_decode.py
Created December 7, 2014 22:55
Python script to decode serial data from Tenma 72-7735 Multimeter to give numbers displayed on lcd screen
import serial
import time
import binascii
ser = serial.Serial(
port='/dev/ttyUSB0',
baudrate=2400,
timeout = 0.1,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS
@wattnotions
wattnotions / tiny_plotter.c
Created May 25, 2014 13:34
This program controls an x-y plotter. Can be used to draw basic lines and shapes
#include <xc.h>
#include <libpic30.h>
#include <stdio.h>
#include <math.h>
#include<uart.h>
@wattnotions
wattnotions / serial_send.c
Created May 25, 2014 13:29
sends values read from the analog channel of a pic microcontroller over UART
#include <xc.h>
#include <stdio.h>
#include <delays.h>
#pragma config FOSC=IRC,MCLRE=OFF,WDTEN=0,LVP=OFF,BOREN=OFF
//Functions
void setup(void);
unsigned int read_analog_channel(void);
void config_usart(void);
@wattnotions
wattnotions / webcam_dist_calc.py
Created May 25, 2014 13:26
Grabs frames from webcam and calculates distance to objects
## program written by Shane Ormonde 7th sept 2013
## updated on 25th January 2014
## calculates the distance of a red dot in the field of view of the webcam.
import cv2
from numpy import *
import math
#variables
@wattnotions
wattnotions / 2d_mapper.py
Created May 25, 2014 13:23
This script generates 2d plots using a stepper motor and a webcam
## updated on 26th January 2014
## scans surrounding area and plots x-y points forming a 2d map
import cv2
from numpy import *
import math
import time
import serial
import matplotlib.pyplot as plt
@wattnotions
wattnotions / mapper_app.c
Created May 25, 2014 13:20
Used in the 2d mapping project to control the stepper motor and send the current step value over serial to a computer
#include <xc.h>
#include <stdio.h>
#include <delays.h>
#pragma config FOSC=IRC,MCLRE=OFF,WDTEN=0,LVP=OFF,BOREN=OFF
//Functions
void setup(void);
void config_usart(void);
void step_pos(int n);
@wattnotions
wattnotions / find_tags_reply.xml
Created May 25, 2014 13:10
Intelleflex RFID reader reply to the 'find_tags' command
<?xml version="1.0" encoding="UTF-8"?>
<findTagsReply>
<errorReport>
<numErrors>0</numErrors>
</errorReport>
<tag>
<time>2014-04-10 11:05:22.393402 +0000</time>
<roSpecID>0</roSpecID>
<type>C1G2</type>
<epc>e2003411b802011412255335</epc>
@wattnotions
wattnotions / find_tags.xml
Created May 25, 2014 13:03
Find tags command for the intelleflew RFID reader
<findTags>
<loop>0</loop>
<roSpec>
<Qval>3</Qval>
<txAnt>1</txAnt>
<RFProfile>2</RFProfile>
<protocol>4</protocol>
<power>20</power>
</roSpec>
</findTags>
@wattnotions
wattnotions / Q_python_bluetooth_test.py
Created May 25, 2014 12:53
Opens phone bluetooth module and connects with computer
#qpy:console
from androidhelper import Android
droid = Android()
if droid.checkBluetoothState().result == True:
print 'Bluetooth is on'
print " Phone info:" + str(droid.bluetoothGetLocalName())
print "Computer info: " + str(droid.bluetoothGetRemoteDeviceName(address='88:53:2E:E8:65:4C'))
droid.bluetoothConnect(address='88:53:2E:E8:65:4C') # connect to computer
# Program written 17 April 2014
# Enter default username and password
# waits for commands, then prints results
import telnetlib
tn = telnetlib.Telnet("192.168.1.100", "23")
print tn.read_until("Username>") # wait till prompted for username
tn.write("alien\n")