Skip to content

Instantly share code, notes, and snippets.

@biomood
biomood / ArduinoTemperature.c
Created April 30, 2011 18:54
Arduino temperature sketch
#include <OneWire.h>
#include <DallasTemperature.h>
// pin connected to sensor
int tempPin = 7;
// define the onewire obj needed for connecting to onewire components
OneWire oneWire(tempPin);
// define dallas obj, makes it easier to read temp
DallasTemperature tempSens(&oneWire);
@biomood
biomood / pySerialArduinoExample.py
Created April 30, 2011 20:46
Example script for sending and receiving data via an arduino
#/usr/bin/python
import serial
import time
# try connecting to serial port
try:
print 'MSG: Connecting to arduino'
arduino = serial.Serial('/dev/tty.usbserial-A600agDn', 9600)
@biomood
biomood / ArduinoSerialSendReceive.c
Created May 1, 2011 12:19
Example arduino sketch sending and receiving data via serial
char msg = '0';
void setup() {
Serial.begin(9600);
}
void loop(){
// While data is sent over serial assign it to the msg
while (Serial.available() > 0){
msg = Serial.read();
@biomood
biomood / HelloWorld_BYTE_CHROUT_LOOPS.asm
Created May 29, 2011 11:06
Hello World for the C64 using .BYTE, CHROUT and loops
;*********************************************************
;* HELLOWORLD using .BYTE, CHROUT and loops *
;*********************************************************
processor 6502
org $C000
;set up some helpful labels
CLEAR = $E544
CHROUT = $FFD2
@biomood
biomood / C64ArrowCursor.asm
Created May 30, 2011 09:37
C64 - Move the cursor using the arrow keys
;*********************************************
;* Arrow Cursor, W,S,A,D *
;*********************************************
processor 6502
org $1000
;setup helpful labels
CLEAR = $E544
CHROUT = $FFD2
@biomood
biomood / RestSharpPOST.cs
Created June 2, 2011 13:56
POST to restful service using .Net and RestSharp
// create the client
RestClient client = new RestClient();
client.BaseUrl = url;
// create the request
RestRequest request = new RestRequest(Method.POST);
request.Resource = service_method;
request.AddParameter("text/xml", body, ParameterType.RequestBody);
// send the request
@biomood
biomood / dingoo_font.lua
Created June 10, 2011 19:04
Code for nLove that displays user-created fonts correctly
require "string"
---------------------------------------------------------
-- a font library for the dingoo --
-- allows for multiple fonts --
---------------------------------------------------------
-- creates a table of images from a font
-- ImageData source, String char_list, Number char_width, Number seperator_width
@biomood
biomood / GameDuino_HelloWorld.c
Created June 16, 2011 20:30
Hello World for the Gameduino
#include <SPI.h>
#include <GD.h>
void setup() {
// give time for the gameduino splash screen to be displayed
delay(2500);
GD.begin();
// load character set
@biomood
biomood / AddRecordLinq.cs
Created June 22, 2011 11:05
Add a record to a DB using Linq to SQL
DataContext db = new DataContext();
try {
db.table.InsertOnSubmit(obj);
db.SubmitChanges();
}
catch(Exception) {
return false;
}
return true;
@biomood
biomood / ImageToH.py
Created June 22, 2011 20:57
Python script to create a gameduino sprite header from an image
import sys
from PIL import Image
from gameduino import prep
image_path = ""
h_name = ""
# retrieve the command line arguments
if (len(sys.argv) > 2):