Sunday, June 5, 2011

Arduino Code

Short and sweet code to send sensor values from LilyPad to SuperCollider:

int message = 0;
int numSensors = 6; //number of analog sensors used
int sensorVal;
int sensorIn = 0;

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

void loop()
{

for(int a=0; a {
sensorVal = analogRead(a); //read sensor values at a
Serial.write(sensorVal/4);
}

Serial.write(message); //send message so SC can distinguish between serial values

}

No comments:

Post a Comment