const int buttonPin = 7; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
Serial.begin(9600);
Serial.println("#S|NOTEPAD|[]#");
}
void loop()
{
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is NOT pressed.
// if it is, the buttonState is LOW:
if (buttonState == LOW) {
// turn LED on:
digitalWrite(ledPin, HIGH);
delay(100);
Serial.println("#S|SENDK|[0&{ENTER}]#");
delay(100);
}
else {
// turn LED off:
digitalWrite(ledPin,LOW);
}
}
Κυριακή 31 Ιανουαρίου 2010
Keyboard keys pou doulevei
Δουλεύει σε όλες τις εφαρμογές εκτός από το Google earth. Δεν μπορούμε να κινήσουμε την γη. Στο Notepad που το δοκιμάσσαμε όμως μπορουμε να κάνουμε Enter και να κινηθούμε μέσα στο κείμενο με τα βελάκια.
Σάββατο 30 Ιανουαρίου 2010
Debouncing
Ξαναγράψαμε τον κώδικα με debouncing αλλά αυτήν την φορά το LED δεν αντιδρά με το pushbutton και όταν ανοίγουμε το Notepad κάνει μια φορά Enter αυτόματα και σταματάει. Το pushbutton δεν το επηρεάζει καθόλου. Έχουμε δοκιμάσει να βάλουμε το Serial.println("#S|SENDK|[0&{ENTER}]#"); κάτω και από το άλλο if και να αλλάξουμε και τις τιμές HIGH και LOW καταλήγοντας είτε να στένει συνεχώς εντολές είτε καθόλου, αλλά ποτέ μέσω του pushbutton.
const int buttonPin = 7; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
// variables will change:
int oldButtonState = LOW;
int ButtonState;
// variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
Serial.begin(9600);
Serial.println("#S|NOTEPAD|[]#");
}
void loop()
{
int newButtonState = digitalRead(buttonPin);
if(newButtonState !=oldButtonState)
{
if (ButtonState == HIGH)
{
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else
{
// turn LED off:
digitalWrite(ledPin, LOW);
delay(10);
Serial.println("#S|SENDK|[0&{ENTER}]#");
delay(10);
}
}
{
oldButtonState = newButtonState;
}
Gobetwino
Με την εντολή Serial.println("#S|NOTEPAD|[]#"); στο void setup καταφέραμε να ανοίξουμε το notepad. Μετά επιχειρήσαμε να αλλάξουμε σειρά στον κέρσορα δίνοντας την εντολή ENTER sto push button Serial.println("#S|SENDK|[0&{ENTER}]#");
Δυστυχώς είτε δεν κάνει καθόλου istixos Enter ή θα κάνει συνεχόμενα και με το που πατάμε το pushbutton σταματά. ( αυτό αλλάζει ανάλογα μετά από ποιό if βάζουμε το Serial.println("#S|SENDK|[0&{ENTER}]#"); )
Δυστυχώς είτε δεν κάνει καθόλου istixos Enter ή θα κάνει συνεχόμενα και με το που πατάμε το pushbutton σταματά. ( αυτό αλλάζει ανάλογα μετά από ποιό if βάζουμε το Serial.println("#S|SENDK|[0&{ENTER}]#"); )
const int buttonPin = 7; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup()
{
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
Serial.begin(9600);
Serial.println("#S|NOTEPAD|[]#");
}
void loop()
{
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH)
{
// turn LED on:
digitalWrite(ledPin, LOW);
Serial.println("#S|SENDK|[0&{ENTER}]#");
}
else
{
// turn LED off:
digitalWrite(ledPin, HIGH);
}
}
InterBall
Η πρώτη φάση του project μας. Το URL του κώδικα είναι: http://s373.net/code/flob/flob.html
Ο κώδικας που άλλαξε είναι του αρχείου monoflob colormode.
Ο καινούριος κώδικας:
/*
monoflob
(vs. 20090621)
started out as buttons to trigger things, ended up
with a nice fade engine in the buttons due to presence
this works really sweet connected to soundfile banks gains
loosely inspired from the great and simple monome
andré sier
http://s373.net
*/
import processing.opengl.*;
import processing.video.*;
import s373.flob.*;
/// vars
Capture video;
Flob flob;
ArrayList blobs;
/// video params
int tresh = 50;
int fade = 50;//120;
int om = 1;
int videores=350;
boolean drawimg=true;
String info="";
PFont font;
int videotex = 1;//0;
int colormode = flob.BLUE;
float fps = 90;
float xe = random(0, 900);
float ye = random(0, 900);
int r = 50;
Monoflob mono;
void setup(){
//bug 882 processing 1.0.1
try { quicktime.QTSession.open(); }
catch (quicktime.QTException qte) { qte.printStackTrace(); }
size(900,900,OPENGL);
frameRate(fps);
rectMode(CENTER);
video = new Capture(this, videores, videores, (int)fps);
flob = new Flob(this, video, width,height);
flob.setTresh(tresh);
flob.setImage(videotex);
flob.setBlur(0);
flob.setMirror(true,false);
flob.setOm(0); //flob.setOm(flob.STATIC_DIFFERENCE);
flob.setOm(1); //flob.setOm(flob.CONTINUOUS_DIFFERENCE);
flob.setFade(fade); //only in continuous difference
flob.setMinNumPixels(20); // smaller blobs
flob.setMaxNumPixels(500); // smaller blobs
flob.setColorMode(colormode);
font = createFont("monaco",9);
textFont(font);
mono = new Monoflob(4,4);
//(20,20);//(10,10);//(3,3);//(5,4);
videotex = (videotex+1)%4;
flob.setImage(videotex);
}
void draw(){
if(video.available()) {
video.read();
blobs = flob.calc(flob.binarize(video));
}
if(drawimg)
image(flob.getImage(), 0, 0, width, height);
// rectMode(CENTER);
// int numblobs = blobs.size();//flob.getNumBlobs();
// for(int i = 0; i < numblobs; i++) {
// ABlob ab = (ABlob)flob.getABlob(i);
// mono.touch(ab.cx,ab.cy, ab.dimx, ab.dimy);
// fill(0,0,255,100);
// rect(ab.cx,ab.cy,ab.dimx,ab.dimy);
// fill(0,255,0,200);
// rect(ab.cx,ab.cy, 5, 5);
// info = ""+ab.id+" "+ab.cx+" "+ab.cy;
// text(info,ab.cx,ab.cy+20);
// }
mono.render();
// stats
// fill(255,152,255);
// rectMode(CORNER);
// rect(5,5,flob.getPresencef()*width,10);
//String stats = ""+frameRate+"\nflob.numblobs: "+numblobs+"\nflob.thresh:" +tresh+
// "
// "\nflob.image: "+videotex+"\nflob.colormode: "+flob.getColorMode()+"\nflob.presence:"+flob.getPresencef();
// fill(0,255,0);
// text(stats,5,25);
fill (255, 0, 0);
noStroke ();
round (xe);
round (ye);
ellipse (xe, ye, r, r);
color white = color (255);
loadPixels();
for (int i = 0; i < width*height; i++) {
if (pixels[i] == white) {
xe = round(random(0,900));
ye = round(random(0,900));
}
}
//updatePixels();
}
void keyPressed(){
if(key=='b')
drawimg^=true;
if (key=='S')
video.settings();
if (key=='s')
saveFrame("monoflob-######.png");
if (key=='i'){
videotex = (videotex+1)%4;
flob.setImage(videotex);
}
if(key=='t'){
tresh--;
flob.setTresh(tresh);
}
if(key=='T'){
tresh++;
flob.setTresh(tresh);
}
if(key=='f'){
fade--;
flob.setFade(fade);
}
if(key=='F'){
fade++;
flob.setFade(fade);
}
if(key=='o'){
om^=1;
flob.setOm(om);
}
if(key=='c'){
colormode=(colormode+1)%5;
flob.setColorMode(colormode);
}
if(key==' ') //space clear flob.background
flob.setBackground(video);
}
Παρασκευή 29 Ιανουαρίου 2010
Using Gobetwino to Control Windows through Arduino
https://sites.google.com/a/divinechildhighschool.org/electronics/Home/Arduino-Lessons/using-gobetwino-to-control-windows-through-arduino
Anoigma programmaton kai ektelesi diatagon sta windows meso Arduino, kataskevazontas entoles sto Godetwino.
Anoigma programmaton kai ektelesi diatagon sta windows meso Arduino, kataskevazontas entoles sto Godetwino.
Κυριακή 24 Ιανουαρίου 2010
ΑΝΑΚΟΙΝΩΣΗ
Την ερχόμενη εβδομάδα θα είμαστε στο Βόλο Παρασκευή και Σάββατο με στόχο να λυθούν τα τεχνικά προβλήματα των projects σας. Μέχρι τότε θα πρέπει να προχωρήσετε όσο μπορείτε. Τυχόν απορίες μπορείτε να τις στείλετε και με email.
Μην ξεχάσετε να αναρτήσετε μέχρι και τη Δευτέρα τη φόρμα παρουσίασης του project.
Μην ξεχάσετε να αναρτήσετε μέχρι και τη Δευτέρα τη φόρμα παρουσίασης του project.
Καλό θα είναι να γίνει και μία καταγραφή των υλικών που θα χρειαστείτε. Μερικά μπορούμε να τα παραγγείλουμε από την Αθήνα και να τα φέρουμε την Παρασκευή. Δεν νομίζω ότι η σχολή μπορεί να συνεισφέρει οικονομικά (έχει ήδη διαθέσει αρκετά), αλλά μπορούμε (εάν προλάβουμε) να ακυρώσουμε μερικά για να καλύψουμε κάποια άλλα.
PROCESSING 3D + xtra
http://processing.org/learning/3d/ - 3D εντολές στο processing
http://processing3d.com - 3D processing και λίγο maya
http://vimeo.com/1444116 - processing 3D web cam
http://www.creativeapplications.net/processing/faceless-void-processing/ - processing 3D web cam
http://www.creativeapplications.net/processing/cop15-identity-processing/ - ΑΝΑΜΝΗΣΤΙΚΟ
http://www.creativeapplications.net/processing/configurator-processing/ - 3D & SOUND
Μην αγνοείτε τα παραδείγματα που έχει ήδη το processing. Ειδικά αυτά με τη σύνδεση με το arduino.
http://processing.org/learning/libraries/
http://processing3d.com - 3D processing και λίγο maya
http://vimeo.com/1444116 - processing 3D web cam
http://www.creativeapplications.net/processing/faceless-void-processing/ - processing 3D web cam
http://www.creativeapplications.net/processing/cop15-identity-processing/ - ΑΝΑΜΝΗΣΤΙΚΟ
http://www.creativeapplications.net/processing/configurator-processing/ - 3D & SOUND
Μην αγνοείτε τα παραδείγματα που έχει ήδη το processing. Ειδικά αυτά με τη σύνδεση με το arduino.
http://processing.org/learning/libraries/
arduino με 8 switches & processing: για Δημήτρη
Βρήκα αυτό το project με 8 διακόπτες και arduino. Δοκίμασε το και ενημέρωσε με εάν βοήθησε καθόλου.
http://webzone.k3.mah.se/projects/arduino-workshop/projects/arduino_meets_processing/instructions/8switches.html
http://webzone.k3.mah.se/projects/arduino-workshop/projects/arduino_meets_processing/instructions/8switches.html
arduino & processing: για παναγιώτη
Δες αυτό το παράδειγμα και πες εάν δουλεύει ή όχι. Λογικά δεν πρέπει να έχεις πρόβλημα. Ενημέρωσε με πως πήγε.
http://arduino.cc/en/Tutorial/PhysicalPixel
http://arduino.cc/en/Tutorial/PhysicalPixel
Δευτέρα 18 Ιανουαρίου 2010
ΠΡΟΒΛΗΜΑ ΜΕ ΕΙΣΑΓΩΓΗ ΣΤΟΙΧΕΙΩΝ ΣΕ ΠΙΝΑΚΑ ΣΤΟ processing
Για να χρησιμοποιησω τα στοιχεια που παιρνω απο το Arduino, πρεπει να τα εισαγω σε εναν πινακα. Εκει βρισκεται το προβλημα. Σε ενα αλλο αρχειο με 3 εισαγωμενα στοιχεια, τα πραγματα δουλευουν σωστα, στο συγκεκριμενο ομως οχι. Με τους ηχους δεν παρουσιαζεται προβλημα.
// processing code
import processing.serial.*;
// Import the Sonia library
import pitaru.sonia_v2_9.*;
// Sample objects for the sounds
Sample box_blue_1;
Sample box_blue_2;
Sample box_blue_3;
Sample box_blue_4;
Sample box_orange_1;
Sample box_orange_2;
Sample box_orange_3;
Sample box_orange_4;
Sample box_green_1;
Sample box_green_2;
Sample box_green_3;
Sample box_green_4;
Sample box_yellow_1;
Sample box_yellow_2;
Sample box_yellow_3;
Sample box_yellow_4;
Sample box_over_analog_1;
Sample box_over_analog_2;
Sample box_over_analog_3;
Sample box_over_analog_4;
Sample box_over_analog_5;
Sample box_over_analog_6;
//vars for arduino's array and sound volume
float blueBox1 = 0;
float bb1=0;
float blueBox2 = 0;
float bb2 =0;
float blueBox3 = 0;
float bb3=0;
float blueBox4 = 0;
float bb4=0;
float orangeBox1 = 0;
float ob1=0;
float orangeBox2 = 0;
float ob2=0;
float orangeBox3 = 0;
float ob3=0;
float orangeBox4 = 0;
float ob4=0;
float greenBox1 = 0;
float gb1=0;
float greenBox2 = 0;
float gb2=0;
float greenBox3 = 0;
float gb3=0;
float greenBox4 = 0;
float gb4=0;
float yellowBox1 = 0;
float yb1=0;
float yellowBox2 = 0;
float yb2=0;
float yellowBox3 = 0;
float yb3=0;
float yellowBox4 = 0;
float yb4=0;
float ab1=0;
float ab2=0;
float ab3=0;
float ab4=0;
float ab5=0;
float ab6=0;
Serial myPort;
void setup() {
Sonia.start(this);
// load sound files
box_blue_1 = new Sample( "boo boo boo.wav" );
box_blue_2 = new Sample( "dj.wav" );
box_blue_3 = new Sample( "gruniara01.wav" );
box_blue_4 = new Sample( "gruniara02.wav" );
box_orange_1 = new Sample( "gruniara03.wav" );
box_orange_2 = new Sample( "gruniara04.wav" );
box_orange_3 = new Sample( "gruniara05.wav" );
box_orange_4 = new Sample( "hight02.wav" );
box_green_1 = new Sample( "low01.wav" );
box_green_2 = new Sample( "phaser01.wav" );
box_green_3 = new Sample( "phaser02.wav" );
box_green_4 = new Sample( "phaser03.wav" );
box_yellow_1 = new Sample( "phaser04.wav" );
box_yellow_2 = new Sample( "trainboom a.wav" );
box_yellow_3 = new Sample( "trainboom b.wav" );
box_yellow_4 = new Sample( "wahwah01.wav" );
box_over_analog_1 = new Sample ("wahwah02.wav");
box_over_analog_2 = new Sample ("wahwah03.wav");
box_over_analog_3 = new Sample ("wahwah04.wav");
box_over_analog_4 = new Sample ("wiuwiu.wav");
box_over_analog_5 = new Sample ("wiuwiu2.wav");
box_over_analog_6 = new Sample ("zbubble01.wav");
// play sound files
box_blue_1.play();
box_blue_2.play();
box_blue_3.play();
box_blue_4.play();
box_orange_1.play();
box_orange_2.play();
box_orange_3.play();
box_orange_4.play();
box_green_1.play();
box_green_2.play();
box_green_3.play();
box_green_4.play();
box_yellow_1.play();
box_yellow_2.play();
box_yellow_3.play();
box_yellow_4.play();
box_over_analog_1.play();
box_over_analog_2.play();
box_over_analog_3.play();
box_over_analog_4.play();
box_over_analog_5.play();
box_over_analog_6.play();
box_blue_1.setVolume(bb1);
box_blue_2.setVolume(bb2);
box_blue_3.setVolume(bb3);
box_blue_4.setVolume(bb4);
box_orange_1.setVolume(ob1);
box_orange_2.setVolume(ob2);
box_orange_3.setVolume(ob3);
box_orange_4.setVolume(ob4);
box_green_1.setVolume(gb1);
box_green_2.setVolume(gb2);
box_green_3.setVolume(gb3);
box_green_4.setVolume(gb4);
box_yellow_1.setVolume(yb1);
box_yellow_2.setVolume(yb2);
box_yellow_3.setVolume(yb3);
box_yellow_4.setVolume(yb4);
box_over_analog_1.setVolume(ab1);
box_over_analog_2.setVolume(ab2);
box_over_analog_3.setVolume(ab3);
box_over_analog_4.setVolume(ab4);
box_over_analog_5.setVolume(ab5);
box_over_analog_6.setVolume(ab6);
// List all the available serial ports
println(Serial.list());
// my usb port is 1
myPort = new Serial(this, Serial.list()[1], 57600);
// don't generate a serialEvent() unless you get a newline character:
myPort.bufferUntil('\n');
box_blue_1.repeat();
box_blue_2.repeat();
box_blue_3.repeat();
box_blue_4.repeat();
box_orange_1.repeat();
box_orange_2.repeat();
box_orange_3.repeat();
box_orange_4.repeat();
box_green_1.repeat();
box_green_2.repeat();
box_green_3.repeat();
box_green_4.repeat();
box_yellow_1.repeat();
box_yellow_2.repeat();
box_yellow_3.repeat();
box_yellow_4.repeat();
box_over_analog_1.repeat();
box_over_analog_2.repeat();
box_over_analog_3.repeat();
box_over_analog_4.repeat();
box_over_analog_5.repeat();
box_over_analog_6.repeat();
}
void draw() {
//not necessary
box_blue_1.setVolume(bb1);
box_blue_2.setVolume(bb2);
box_blue_3.setVolume(bb3);
box_blue_4.setVolume(bb4);
box_orange_1.setVolume(ob1);
box_orange_2.setVolume(ob2);
box_orange_3.setVolume(ob3);
box_orange_4.setVolume(ob4);
box_green_1.setVolume(gb1);
box_green_2.setVolume(gb2);
box_green_3.setVolume(gb3);
box_green_4.setVolume(gb4);
box_yellow_1.setVolume(yb1);
box_yellow_2.setVolume(yb2);
box_yellow_3.setVolume(yb3);
box_yellow_4.setVolume(yb4);
box_over_analog_1.setVolume(ab1);
box_over_analog_2.setVolume(ab2);
box_over_analog_3.setVolume(ab3);
box_over_analog_4.setVolume(ab4);
box_over_analog_5.setVolume(ab5);
box_over_analog_6.setVolume(ab6);
}
void serialEvent(Serial myPort) {
// get the ASCII string:
String inString = myPort.readStringUntil('\n');
if (inString != null) {
// trim off any whitespace:
inString = trim(inString);
// split the string on the commas and convert the
// resulting substrings into an integer array:
float[] boxes = float(split(inString, ",")); // EDW EINAI TO PROVLIMA
// check the results
println(boxes[1]); // DEN VAZEI TA DEDOMENA SE OLES TIS THESEIS TOU PINAKA PARA MONO STO boxes[1] KAI OTAN TIPONO KAPOIO ALLO KARASAREI
// if the array has at least 16 elements, I got
// the whole thing. I put the numbers in the
// boxes variables:
if (boxes.length >=16) {// DEN EKTELEITAI KAN
blueBox1 = boxes[0];
blueBox2 = boxes[1];
blueBox3 = boxes[2];
blueBox4 = boxes[3];
orangeBox1 = boxes[4];
orangeBox2 = boxes[5];
orangeBox3 = boxes[6];
orangeBox4 = boxes[7];
greenBox1 = boxes[8];
greenBox2 = boxes[9];
greenBox3 = boxes[10];
greenBox4 = boxes[11];
yellowBox1 = boxes[12];
yellowBox2 = boxes[13];
yellowBox3 = boxes[14];
yellowBox4 = boxes[15];
// i change the sound volumes
// DIGITAL INPUTS
if (blueBox1==1) {
bb1=1;
}
else {
bb1=0;
}
if (blueBox2==1) {
bb2=1;
}
else {
bb2=0;
}
if (blueBox3==1) {
bb3=1;
}
else {
bb3=0;
}
if (blueBox4==1) {
bb4=1;
}
else {
bb4=0;
}
if (orangeBox1==1) {
ob1=1;
}
else {
ob1=0;
}
if (orangeBox2==1) {
ob2=1;
}
else {
ob2=0;
}
if (orangeBox3==1) {
ob3=1;
}
else {
ob3=0;
}
if (orangeBox4==1) {
ob4=1;
}
else {
ob4=0;
}
if (greenBox1==1) {
gb1=1;
}
else {
gb1=0;
}
if (greenBox2==1) {
gb2=1;
}
else {
gb2=0;
}
//ANALOG INPUTS
if (greenBox3>=1020) {
gb3=1;
}
else {
gb3=0;
}
if (greenBox4>=1020) {
gb4=1;
}
else {
gb4=0;
}
if (yellowBox1>=1020) {
yb1=1;
}
else {
yb1=0;
}
if (yellowBox2>=1020) {
yb2=1;
}
else {
yb2=0;
}
if (yellowBox3>=1020) {
yb3=1;
}
else {
yb3=0;
}
if (yellowBox4>=1020) {
yb4=1;
}
else {
yb4=0;
}
}
}
}
void stop()
{
// i must stop the Sonia Library
Sonia.stop();
super.stop();
}
για τα αρχεια των ηχων επικοινωνειστε με mail.
// processing code
import processing.serial.*;
// Import the Sonia library
import pitaru.sonia_v2_9.*;
// Sample objects for the sounds
Sample box_blue_1;
Sample box_blue_2;
Sample box_blue_3;
Sample box_blue_4;
Sample box_orange_1;
Sample box_orange_2;
Sample box_orange_3;
Sample box_orange_4;
Sample box_green_1;
Sample box_green_2;
Sample box_green_3;
Sample box_green_4;
Sample box_yellow_1;
Sample box_yellow_2;
Sample box_yellow_3;
Sample box_yellow_4;
Sample box_over_analog_1;
Sample box_over_analog_2;
Sample box_over_analog_3;
Sample box_over_analog_4;
Sample box_over_analog_5;
Sample box_over_analog_6;
//vars for arduino's array and sound volume
float blueBox1 = 0;
float bb1=0;
float blueBox2 = 0;
float bb2 =0;
float blueBox3 = 0;
float bb3=0;
float blueBox4 = 0;
float bb4=0;
float orangeBox1 = 0;
float ob1=0;
float orangeBox2 = 0;
float ob2=0;
float orangeBox3 = 0;
float ob3=0;
float orangeBox4 = 0;
float ob4=0;
float greenBox1 = 0;
float gb1=0;
float greenBox2 = 0;
float gb2=0;
float greenBox3 = 0;
float gb3=0;
float greenBox4 = 0;
float gb4=0;
float yellowBox1 = 0;
float yb1=0;
float yellowBox2 = 0;
float yb2=0;
float yellowBox3 = 0;
float yb3=0;
float yellowBox4 = 0;
float yb4=0;
float ab1=0;
float ab2=0;
float ab3=0;
float ab4=0;
float ab5=0;
float ab6=0;
Serial myPort;
void setup() {
Sonia.start(this);
// load sound files
box_blue_1 = new Sample( "boo boo boo.wav" );
box_blue_2 = new Sample( "dj.wav" );
box_blue_3 = new Sample( "gruniara01.wav" );
box_blue_4 = new Sample( "gruniara02.wav" );
box_orange_1 = new Sample( "gruniara03.wav" );
box_orange_2 = new Sample( "gruniara04.wav" );
box_orange_3 = new Sample( "gruniara05.wav" );
box_orange_4 = new Sample( "hight02.wav" );
box_green_1 = new Sample( "low01.wav" );
box_green_2 = new Sample( "phaser01.wav" );
box_green_3 = new Sample( "phaser02.wav" );
box_green_4 = new Sample( "phaser03.wav" );
box_yellow_1 = new Sample( "phaser04.wav" );
box_yellow_2 = new Sample( "trainboom a.wav" );
box_yellow_3 = new Sample( "trainboom b.wav" );
box_yellow_4 = new Sample( "wahwah01.wav" );
box_over_analog_1 = new Sample ("wahwah02.wav");
box_over_analog_2 = new Sample ("wahwah03.wav");
box_over_analog_3 = new Sample ("wahwah04.wav");
box_over_analog_4 = new Sample ("wiuwiu.wav");
box_over_analog_5 = new Sample ("wiuwiu2.wav");
box_over_analog_6 = new Sample ("zbubble01.wav");
// play sound files
box_blue_1.play();
box_blue_2.play();
box_blue_3.play();
box_blue_4.play();
box_orange_1.play();
box_orange_2.play();
box_orange_3.play();
box_orange_4.play();
box_green_1.play();
box_green_2.play();
box_green_3.play();
box_green_4.play();
box_yellow_1.play();
box_yellow_2.play();
box_yellow_3.play();
box_yellow_4.play();
box_over_analog_1.play();
box_over_analog_2.play();
box_over_analog_3.play();
box_over_analog_4.play();
box_over_analog_5.play();
box_over_analog_6.play();
box_blue_1.setVolume(bb1);
box_blue_2.setVolume(bb2);
box_blue_3.setVolume(bb3);
box_blue_4.setVolume(bb4);
box_orange_1.setVolume(ob1);
box_orange_2.setVolume(ob2);
box_orange_3.setVolume(ob3);
box_orange_4.setVolume(ob4);
box_green_1.setVolume(gb1);
box_green_2.setVolume(gb2);
box_green_3.setVolume(gb3);
box_green_4.setVolume(gb4);
box_yellow_1.setVolume(yb1);
box_yellow_2.setVolume(yb2);
box_yellow_3.setVolume(yb3);
box_yellow_4.setVolume(yb4);
box_over_analog_1.setVolume(ab1);
box_over_analog_2.setVolume(ab2);
box_over_analog_3.setVolume(ab3);
box_over_analog_4.setVolume(ab4);
box_over_analog_5.setVolume(ab5);
box_over_analog_6.setVolume(ab6);
// List all the available serial ports
println(Serial.list());
// my usb port is 1
myPort = new Serial(this, Serial.list()[1], 57600);
// don't generate a serialEvent() unless you get a newline character:
myPort.bufferUntil('\n');
box_blue_1.repeat();
box_blue_2.repeat();
box_blue_3.repeat();
box_blue_4.repeat();
box_orange_1.repeat();
box_orange_2.repeat();
box_orange_3.repeat();
box_orange_4.repeat();
box_green_1.repeat();
box_green_2.repeat();
box_green_3.repeat();
box_green_4.repeat();
box_yellow_1.repeat();
box_yellow_2.repeat();
box_yellow_3.repeat();
box_yellow_4.repeat();
box_over_analog_1.repeat();
box_over_analog_2.repeat();
box_over_analog_3.repeat();
box_over_analog_4.repeat();
box_over_analog_5.repeat();
box_over_analog_6.repeat();
}
void draw() {
//not necessary
box_blue_1.setVolume(bb1);
box_blue_2.setVolume(bb2);
box_blue_3.setVolume(bb3);
box_blue_4.setVolume(bb4);
box_orange_1.setVolume(ob1);
box_orange_2.setVolume(ob2);
box_orange_3.setVolume(ob3);
box_orange_4.setVolume(ob4);
box_green_1.setVolume(gb1);
box_green_2.setVolume(gb2);
box_green_3.setVolume(gb3);
box_green_4.setVolume(gb4);
box_yellow_1.setVolume(yb1);
box_yellow_2.setVolume(yb2);
box_yellow_3.setVolume(yb3);
box_yellow_4.setVolume(yb4);
box_over_analog_1.setVolume(ab1);
box_over_analog_2.setVolume(ab2);
box_over_analog_3.setVolume(ab3);
box_over_analog_4.setVolume(ab4);
box_over_analog_5.setVolume(ab5);
box_over_analog_6.setVolume(ab6);
}
void serialEvent(Serial myPort) {
// get the ASCII string:
String inString = myPort.readStringUntil('\n');
if (inString != null) {
// trim off any whitespace:
inString = trim(inString);
// split the string on the commas and convert the
// resulting substrings into an integer array:
float[] boxes = float(split(inString, ",")); // EDW EINAI TO PROVLIMA
// check the results
println(boxes[1]); // DEN VAZEI TA DEDOMENA SE OLES TIS THESEIS TOU PINAKA PARA MONO STO boxes[1] KAI OTAN TIPONO KAPOIO ALLO KARASAREI
// if the array has at least 16 elements, I got
// the whole thing. I put the numbers in the
// boxes variables:
if (boxes.length >=16) {// DEN EKTELEITAI KAN
blueBox1 = boxes[0];
blueBox2 = boxes[1];
blueBox3 = boxes[2];
blueBox4 = boxes[3];
orangeBox1 = boxes[4];
orangeBox2 = boxes[5];
orangeBox3 = boxes[6];
orangeBox4 = boxes[7];
greenBox1 = boxes[8];
greenBox2 = boxes[9];
greenBox3 = boxes[10];
greenBox4 = boxes[11];
yellowBox1 = boxes[12];
yellowBox2 = boxes[13];
yellowBox3 = boxes[14];
yellowBox4 = boxes[15];
// i change the sound volumes
// DIGITAL INPUTS
if (blueBox1==1) {
bb1=1;
}
else {
bb1=0;
}
if (blueBox2==1) {
bb2=1;
}
else {
bb2=0;
}
if (blueBox3==1) {
bb3=1;
}
else {
bb3=0;
}
if (blueBox4==1) {
bb4=1;
}
else {
bb4=0;
}
if (orangeBox1==1) {
ob1=1;
}
else {
ob1=0;
}
if (orangeBox2==1) {
ob2=1;
}
else {
ob2=0;
}
if (orangeBox3==1) {
ob3=1;
}
else {
ob3=0;
}
if (orangeBox4==1) {
ob4=1;
}
else {
ob4=0;
}
if (greenBox1==1) {
gb1=1;
}
else {
gb1=0;
}
if (greenBox2==1) {
gb2=1;
}
else {
gb2=0;
}
//ANALOG INPUTS
if (greenBox3>=1020) {
gb3=1;
}
else {
gb3=0;
}
if (greenBox4>=1020) {
gb4=1;
}
else {
gb4=0;
}
if (yellowBox1>=1020) {
yb1=1;
}
else {
yb1=0;
}
if (yellowBox2>=1020) {
yb2=1;
}
else {
yb2=0;
}
if (yellowBox3>=1020) {
yb3=1;
}
else {
yb3=0;
}
if (yellowBox4>=1020) {
yb4=1;
}
else {
yb4=0;
}
}
}
}
void stop()
{
// i must stop the Sonia Library
Sonia.stop();
super.stop();
}
για τα αρχεια των ηχων επικοινωνειστε με mail.
Τετάρτη 13 Ιανουαρίου 2010
Γεύμα Εργασίας
Καλή Χρονιά σε όλους.
Λέγαμε να συναντηθούμε να φάμε delivery στη σχολή αυτή την πέμπτη 14.01.2010 κατα τις 9:10
Κατα τη διάρκεια του φαγητού σκοπεύουμε να συζητήσουμε και για τα projects του εξαμήνου.
Λέγαμε να συναντηθούμε να φάμε delivery στη σχολή αυτή την πέμπτη 14.01.2010 κατα τις 9:10
Κατα τη διάρκεια του φαγητού σκοπεύουμε να συζητήσουμε και για τα projects του εξαμήνου.
Εγγραφή σε:
Σχόλια (Atom)