Paja

Icon

Rapid prototyping for music, art and design work

Pony(tentio metre)

The electronics part was easy:

Arduino with potentiometre

Pony!

Potentiometre was connected straight to analog pin 3 .. And Arduino code was very easy, too:

int val;
int Component = 3;    // this is analog pin 3

void setup(void) {
  Serial.begin(9600);
}

void loop(void) {
  val = analogRead(Component);
  Serial.println(val);
  delay(100);
}

And then we used Arduino example code for C language to communicate with it with electronics:

int serialport_init(const char* serialport, int baud);
int serialport_write(int fd, const char* str);
int serialport_read_until(int fd, char* buf, char until);

And using Xcode editor software, we used OpenGL pony example program to make developing faster and changed the pony location from looping function to reading potentio metre value. potentio metre max value was around 443, and because circle is 360° we had to adjust the values a bit:

serialport_read_until(fd, buf, 'n');
	tmp= atoi(buf);
WalkAngle = (float) tmp /443*360;

This could have been written in shorter and cleaner code too, though. ( serialport_read_until(fd, buf, '\n'); WalkAngle = (float) atoi(buf) /443*360; ) But it was quick hack to get it work. Now we could move pony around with potentio metre:

To try out yourself, you need to change char serialport[] = "/dev/tty.usbserial-A3000X1j"; to your local USB address (arduino -> Serialports -> selected one). and then load project file in (uncompressed) zip file to xcode. Arduino has to be running before starting pony application.

Download ponyzip source code for OSX here!

Click here to download Bluepony os x application file if you are too lazy to compile it yourself 🙂

Experiments of Joonas Kiviharju and Jukka Liukkonen.

Facebook Twitter Email

Category: Media Lab Helsinki, Student Projects

Tagged:

One Response

  1. michihito says:

    I want to see the movie! not just a screenshot.

Social links powered by Ecreative Internet Marketing