Skip to content

Instantly share code, notes, and snippets.

@biomood
biomood / chumby_framebuffer.c
Created May 1, 2011 19:58
Writing to the frame buffer on a chumby in c
#include <stdio.h>
#include <stdlib.h>
#define FRAMESIZE 320*240*2
char * framebuffer;
void set_screen(FILE * frame);
void set_colour(FILE * frame, char colour[]);
void draw_pixel(int x, int y, char * colour);
char * rgb_to_byte(int red, int green, int blue);
@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 / 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 / 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);