Sunday, May 4, 2008

[prototype13_final]






































above: prototype in site and details of movement.
below: the overall apparatus.



detail of movement.


movement in site.


tactile interaction.

Labels: , , , ,


Tuesday, March 25, 2008

[prototype06_mysql to processing to pbasic to output]









Here, we have an LED responding to Air Quality Data being streamed over the internet and filtered through MYSQL. Processing is used to stream the data.
PROCESSING
import de.bezier.sql.*;
import de.bezier.mysql.*;

import processing.serial.*;


MySQL msql;

Serial myPort;

String table = "airTest";
String[] si = new String[636];

void setup()
{
size( 100, 100 );

println(Serial.list());
myPort = new Serial(this, "COM3", 2400);
//String user = "dbo238508103";
// String pass = "Ueb6pwb8";
// name of the database to use
//
//String database = "db238508103";



msql = new MySQL( "db192.perfora.NET", "db238508103", "dbo238508103", "Ueb6pwb8", this );

if ( msql.connect() )
{
// create a table with an id and a word
//
msql.execute( "CREATE TABLE IF NOT EXISTS " + table + " ("+
"id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,"+
"word VARCHAR( 255 )"+
")"
);




msql.query( "SELECT * FROM " + table );

int scount = 0;
while (msql.next())
{
String s = msql.getString("word");
si[scount] = s;
int n = msql.getInt("id");
println(s + " " + n);
float f = float(s);


scount = scount + 1;
}

// need to find out how many rows there are in table?
//
msql.query( "SELECT COUNT(*) FROM " + table );
msql.next();
println( "number of rows: " + msql.getInt(1) );
}
else
{
// connection failed !
}


}

void draw()
{

int gg = 0;
int f;

while(gg < f ="int(si[gg]);">0){

delay(1000);
println("port");
println(myPort.available());

if (myPort.available() == 0) {
delay(1000);
int x = int(si[gg]);
println(x);
myPort.write(x);
println("value");
println(si[gg]);
gg = gg + 1;
// myPort.stop();

PBASIC
'{$STAMP BS2}
'{$PBASIC 2.5}

x VAR Byte
y VAR Byte
proIn VAR Byte

Main:
DO

SERIN 16, 16780, [proIn]

IF proIn>10 THEN
LOW 2
ENDIF

IF proIn<10>
HIGH 2
ENDIF


IF proIn>20 THEN
LOW 3
ENDIF
IF proIn<30>
HIGH 3
ENDIF


IF proIn<30>
LOW 4
ENDIF
IF proIn>50 THEN
HIGH 4
ENDIF

IF proIn<50>
LOW 4
ENDIF
IF proIn>70 THEN
HIGH 4
ENDIF

LOOP
END

}

myPort.clear();
delay(1000);
}

}


Labels: , , ,


Wednesday, March 12, 2008

[prototype05_mysql to processing]





here we have a found code with our MYSQL data plugged in. when it is run it projects a stream of data. the draw portion(or the output) is not quite working.








PROCESSING
import de.bezier.mysql.*;


// created 2005-05-10 by fjenett
// updated 2005-11-16 by fjenett


MySQL msql;
void setup()
{
size( 100, 100 );
// this example assumes that you are running the
// mysql server locally (on "localhost").
//

// replace --username--, --password-- with your mysql-account.
//
//String user = "--username--";
//String pass = "--password--";

// name of the database to use
//
//String database = "--database--";

// name of the table that will be created
//
String table = "test";

// connect to database of server "localhost"
//
//msql = new MySQL( "localhost", database, user, pass, this );
msql = new MySQL( "SQL06.FREEMYSQL.NET", "ecovis", "fbitonti", "housebed202", this );
if ( msql.connect() )
{
// create a table with an id and a word
//
msql.execute( "CREATE TABLE IF NOT EXISTS " + table + " ("+
"id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,"+
"word VARCHAR( 255 )"+
")"
);

// fill the table with some data
//
msql.execute( "INSERT INTO " + table + " (word) VALUES (\"Lorem\")" );
msql.execute( "INSERT INTO " + table + " (word) VALUES (\"ipsum\")" );
msql.execute( "INSERT INTO " + table + " (word) VALUES (\"dolor\")" );

// now read it back out
//
msql.query( "SELECT * FROM " + table );

while (msql.next())
{
String s = msql.getString("word");
int n = msql.getInt("id");
println(s + " " + n);
}

// need to find out how many rows there are in table?
//
msql.query( "SELECT COUNT(*) FROM " + table );
msql.next();
println( "number of rows: " + msql.getInt(1) );
}
else
{
// connection failed !
}
}

void draw()
{
// i know this is not really a visual sketch ...
}

Labels: , ,


This page is powered by Blogger. Isn't yours?