Hey guys,
Interaction team here, just thought we'd pop in and let you guys know what we've been up to.
First, one problem we currently have is that to run an input / output script we need a USB Hub. It would be reeeally great if anyone has one of these around that they could bring in for tomorrow? If not we can go get one, which won't be too hard, it will just save us a bit of money.
Otherwise, we've sourced the LED's already and just need to solder them. And as far as scripting goes, we've got the input script working, but haven't been able to test the input / output script (due to the lack of USB). I have done a theoretical input / output script, which I hope will work, but we're going to have to find out tomorrow. Also, someone wanted to have a look at the script? So I'll post what we've got at the bottom.
One last concern I had with was the theoretical skin. Although their's nothing wrong with it, I was just wondering how you guys planned on disgusing / displaying the motors / sensors/ hardware? Just something to think about for tomorrow.
Peace,
Interaction.
And here's the script:
[Note; this script is using 4 light sensors, which can easily be interchanged for whatever we want.]
import com.phidgets.*;
import com.phidgets.event.*;
InterfaceKitPhidget ik;
float light0;
float light1;
float light2;
float light3;
int xPos;
void setup()
{
size(1024,300);
setupIK();
smooth();
}
void draw()
{
readIK();
background(0);
light0 = map (light0,0,1000,0,height);
fill(255,255,0);
noStroke();
ellipse(xPos,(height-light0),10,10);
light1 = map (light1,0,1000,0,height);
fill(255,0,0);
noStroke();
ellipse(xPos,(height-light1),10,10);
light2 = map (light2,0,1000,0,height);
fill(0,0,255);
noStroke();
ellipse(xPos,(height-light2),10,10);
light3 = map (light3,0,1000,0,height);
fill(0,255,0);
noStroke();
ellipse(xPos,(height-light3),10,10);
if (xPos >= width)
{
xPos = 0;
}
else {
xPos++;
}
}
void setupIK()
{
try
{
ik = new InterfaceKitPhidget();
ik.openAny();
println("Waiting for Phidget");
ik.waitForAttachment();
println("OK ready to go");
}
catch(Exception e)
{
println("ERROR");
System.out.println(e);
}
}
void readIK()
{
try
{
light0 = (float)ik.getSensorValue(0);
light1 = (float)ik.getSensorValue(1);
light2 = (float)ik.getSensorValue(2);
light3 = (float)ik.getSensorValue(3);
}
catch (Exception e)
{
println(e.toString());
}
}
Sunday, August 30, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment