2009年1月29日 星期四

Arduino IR Remote

RECEIVER:
int ir_pin = 7; //Sensor pin 1 wired through a 220 ohm resistor
int led_pin = 9; //"Ready to Recieve" flag, not needed but nice
int debug = 0; //Serial connection must be started to debug
int start_bit = 2000; //Start bit threshold (Microseconds)
int bin_1 = 1000; //Binary 1 threshold (Microseconds)
int bin_0 = 400; //Binary 0 threshold (Microseconds)
int lll=0;

void setup() {
pinMode(led_pin, OUTPUT); //This shows when we're ready to recieve
pinMode(ir_pin, INPUT);
digitalWrite(led_pin, LOW); //not ready yet
Serial.begin(9600);
}

void loop() {
int key = getIRKey(); //Fetch the key
Serial.print("Key Recieved: ");
Serial.println(key);
if(key==1301&&lll==0)
{digitalWrite(10, HIGH); lll=1;}
else if(key==1301&&lll==1)
{digitalWrite(10, LOW); lll=0;}
delay(1000);

}


int getIRKey() {
int data[12];
digitalWrite(led_pin, HIGH); //Ok, i'm ready to recieve
while(pulseIn(ir_pin, LOW) < 2200) { //Wait for a start bit
}
data[0] = pulseIn(ir_pin, LOW); //Start measuring bits, I only want low pulses
data[1] = pulseIn(ir_pin, LOW);
data[2] = pulseIn(ir_pin, LOW);
data[3] = pulseIn(ir_pin, LOW);
data[4] = pulseIn(ir_pin, LOW);
data[5] = pulseIn(ir_pin, LOW);
data[6] = pulseIn(ir_pin, LOW);
data[7] = pulseIn(ir_pin, LOW);
data[8] = pulseIn(ir_pin, LOW);
data[9] = pulseIn(ir_pin, LOW);
data[10] = pulseIn(ir_pin, LOW);
data[11] = pulseIn(ir_pin, LOW);
digitalWrite(led_pin, LOW);

if(debug == 1) {
Serial.println("-----");
}
for(int i=0;i<11;i++) { //Parse them
if (debug == 1) {
Serial.println(data[i]);
}
if(data[i] > bin_1) { //is it a 1?
data[i] = 1;
} else {
if(data[i] > bin_0) { //is it a 0?
data[i] = 0;
} else {
data[i] = 2; //Flag the data as invalid; I don't know what it is!
}
}
}

for(int i=0;i<11;i++) { //Pre-check data for errors
if(data[i] > 1) {
return -1; //Return -1 on invalid data
}
}

int result = 0;
int seed = 1;
for(int i=0;i<11;i++) { //Convert bits to integer
if(data[i] == 1) {
result += seed;
}
seed = seed * 2;
}
return result; //Return key number
}

SENDER:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1209565937

2009年1月26日 星期一

Arduino bootloader 教學

只需要自備Arduino Diecimila基本板子
就可以大量購買所需的ATmega168 晶片,自己燒錄bootloader
製造arduino
感謝 Mr.Suz. 開發的avrdude-serjtag工具。

【前po】自製240元的arduino(不含usb connector)

參考網址:
http://robertcarlsen.net/blog/?p=221
http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html

2009年1月11日 星期日

Siggraph2009: BioLogic: A Natural History of Digital Life

NEW!!!
MSOrgm (Motivational Sensitive Organism) is as 1 of 14 pieces, will be showing in Biologic ART at Siggraph 2009.

Siggraph 2009 - BioLogic Jurors

Marcia Tanner - independent curator and writer based in Berkeley and former director of San Jose Institute of Contemporary Art

Sabrina Raaf - artist working in experimental sculptural media and Asst. Prof. in the School of Art and Design at the University of Illinois at Chicago

Suzanne Anker - artist and theorist, co-author of The Molecular Gaze: Art in the Genetic Age, and Chair of Fine Arts at the School of Visual Arts in NYC

Cezanne Charles - artist, curator, Creative Industries Director for ArtServe Michigan, and former Executive Director of New Media Scotland

Sascha Pohflepp - artist, designer, contributing writer for we-make-money-not-art, and member of Design Interactions at RCA, London

John Marshall - artist, designer, curator, and Asst. Prof. in the School of Art & Design at the University of Michigan

http://www.core.form-ula.com/2008/12/18/eventacm-siggraph-2009leonardocall-for-papers-and-artwork/