Miu Ling Lam

Media Art, Physcial Computing, Interaction Design – a blog connects me to like minds

Arduino Multiplexing Example 1

Processing code:

import processing.serial.*;
Serial myPort;

int numChannels = 16;

void setup() {
  size(1280,800);
//  println(Serial.list());
  myPort = new Serial(this, Serial.list()[0], 9600);
  background(0);
}

void draw() {
}

void mouseMoved() {
  int ID = int(map(mouseX,0,width,0,numChannels));
  myPort.write(ID);
}

Arduino code:

// 16 channels
int r0 = 0;
int r1 = 0;
int r2 = 0;
int r3 = 0;
int row = 0;
int ID = 0;
int bin [] = {0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111};

void setup(){
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  Serial.begin(115200);
}

void loop () {
  if (Serial.available()) {
    ID = Serial.read();
    Serial.print(ID);
  }
  row = bin[ID];
  r0 = row & 0x01;
  r1 = (row>>1) & 0x01;
  r2 = (row>>2) & 0x01;
  r3 = (ID>7)? 1:0;
  digitalWrite(2, r0);
  digitalWrite(3, r1);
  digitalWrite(4, r2);
  digitalWrite(5, r3);
}
Advertisements

Filed under: Physcial Computing, Programming

Morse Corsage

Morse Corsage Componets

Morse Corsage is an interactive installation that transmits and decodes Morse code. It consists of a wearable device, the corsage, which is made of a crocheted flower and custom electronics, and a processing program that listens and decodes Morse code messages sent from the corsage. Morse code is transmitted wirelessly via Bluetooth. The corsage is worn on the wearer’s wrist and he/she can send Morse code by pressing the push-button sewed on the corsage.

I coupled the processing code with Apple script that talks to Skype to make Morse Corsage make phone calls and send text messages, tho I consider this is an art piece more than a communication device.

I will post the instructions soon. Here is the source code:

Read the rest of this entry »

Filed under: Physcial Computing, , , ,

Pages

Archives

November 2017
S M T W T F S
« May    
 1234
567891011
12131415161718
19202122232425
2627282930