Connecting a variable resistor to the arduino, analog in


(Sketch based on illustrations from the books “Physical Computing” and “Making things talk”)

Most variable resistors have two connectors (if they have three they should most likely be connected like the potentiometer).

One goes to the +5v output on the arduino, the other one goes both to the analog input of the arduino and through a fixed resistor (the value should be related to the value of the variable resistor, but I usually try with a 10k resistor first) to ground.

You can use the same example as for the previous post.


Connecting a potentiometer to the arduino, analog in


(sketch based on illustrations in the books “Physical Computing” and “Making things talk”.)

Here is a simple arduino code example illustrating both Analog in and out:

int potVar = 0;

void setup() {
pinMode(11, OUTPUT);

void loop() {
//read the voltage on the potentiometer:
potVar = analogRead(0);
//print the value out:
Serial.println(potVar, DEC);
//slight pause
//dim the LED. since the resolution of the input is 10bit and the output(1024)
//is only 8bit (255) we need to divide potVar by 4 to get the right range

Digital input to the arduino


(sketch based on illustrations from Physical Computing and Making Things Talk)

The simplest code to get a reading from a switch is the Button example from the arduino tutorials.

Here is a modification of this code illustrating the principle of edge detection, just sending out a value whenever the state of the switch changes (and not everytime the arduino checks the state of the input pin). This would be useful for instance if used together with´s applescript proxy

int ledPin = 13; // choose the pin for the LED
int inputPin = 2; // choose the input pin (for a pushbutton)
int val = 0; // variable for reading the pin status
int prevState = 0;

void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inputPin, INPUT); // declare pushbutton as input

void loop(){
prevState = val;
val = digitalRead(inputPin); // read input value
if (val != prevState) {
if (val == HIGH) { // check if the input is HIGH
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);

And finally a simple example to show how you could work with multiple input:

int inputPin1 = 2;
int inputPin2 = 3;

void setup()
pinMode(inputPin1, INPUT);
pinMode(inputPin2, INPUT);

void loop()


LFTK: A project by Michelle Teran and Jeff Mann dealing with kinetic sculptures and social interaction via networked communication. On this site you will find “recipes” for building the sculptures. The sculptures are based on sharing meals.

1+’5 4r+ m4|/|

Just about autonomous art featuring electronic components:

Shieh Chieh Huang

Wim Delvoye – Cloaca (the digestion machine)

The Brotherhood (example)

The Brotherhood. A stunning and profound installation by Woody Vasulka, Tokyo 1998.


Here’s a link to Fishbrowser (if only I could touch the mouse, my life would be perfect), Motherboard 1998.