Tuesday, September 6, 2011

Arduino Code

#include

byte analogPin = 0;

void analogWriteCallback(byte pin, int value)
{
if (IS_PIN_PWM(pin)) {
pinMode(PIN_TO_DIGITAL(pin), OUTPUT);
analogWrite(PIN_TO_PWM(pin), value);
}
}

void setup()
{
Firmata.setFirmwareVersion(0, 1);
Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
Firmata.begin(57600);
}

void loop()
{
while(Firmata.available()) {
Firmata.processInput();
}
Firmata.sendAnalog(analogPin, analogRead(analogPin));
analogPin = analogPin + 1;
if (analogPin >= TOTAL_ANALOG_PINS) analogPin = 0;
}

Saturday, August 6, 2011

Processing Code

import processing.serial.*;

Serial myPort;
int xPos = 1;

void setup () {
size(400, 300);
println(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
myPort.bufferUntil('\n');
background(0);
}
void draw () {
}
void serialEvent (Serial myPort) {
String inString = myPort.readStringUntil('\n');

if (inString != null) {

inString = trim(inString);

float inByte = float(inString);
inByte = map(inByte, 0, 1023, 0, height);


stroke(127,34,255);
line(xPos, height, xPos, height - inByte);

if (xPos >= width) {
xPos = 0;
background(0);
}
else {
xPos++;
}
}
}

Monday, November 1, 2010

Monday, October 25, 2010

Listen!

Base Ideas






These images all relate to common misconceptions people hold such as goldfish have only a 3 second memory, false. Bulls are angered buy the colour red, false. We only use 10% of our brains, false. Bats are blind, false. I decided to go with these as it demonstrates very well the idea of truth and how what you may believe in could be completely false.