Você está na página 1de 19

Global climate mapped onto PATH

q
Mapping reduced to extreme climates
q
Cloud forest Desert Open ocean Glacier
(Cloudy) (Clear) (Cloudy) (Clear)
(Warm light) (Warm light) (Cool light) (Cool light)
(No wind) (Wind) (Wind) (No wind)

Remote weather data


(Wireless internet access)
q
Sunlight Clouds Wind
(LED) (Fogger) (Sound)
q
Live representation of climate
Global climate mapped onto PATH
q
Mapping reduced to extreme climates
q
Cloud forest Desert Open ocean Glacier
(Cloudy) (Clear) (Cloudy) (Clear)
(Warm light) (Warm light) (Cool light) (Cool light)
(No wind) (Wind) (Wind) (No wind)

Remote weather data


(Wireless internet access)
q
Sunlight Clouds Wind
(LED) (Fogger) (Sound)
q
Live representation of climate
Processing
import processing.serial.*;
Serial myPort;

import gifAnimation.*;

PImage[] satimg;
int w = 400;
int h = 334;
int[] b = new int[5];
int bcount;
int fan[] = new int[9];
int margin = 0;
int fanoutput = "";

void setup() {
size(w, h);
satimg = Gif.getPImages(this, "http://sirocco.accuweather.com/sat_mosaic_400x300_public/rs/isarNE.gif");
myPort = new Serial(this, Serial.list()[2], 9600);
}

void draw() {
for (int i=0; i<4; i++){
image(satimg[i],0,0);
loadPixels();
bcount = 1;
for (int x=208; x<210; x++){
for (int y=167; y<169; y++){
b[bcount] = 255 - int(brightness(pixels[y*w+x]));
fill(b[bcount]);
rect(x+bcount*30,y,30,30);
bcount++;
}
}
// zone 1 - 3
if (b[1] > b[3]){
fan[1] = 49;
Processing
fan[7] = 48;
println("fan 1 on");
} else if (b[3] > b[1]){
fan[1] = 48;
fan[7] = 49;
println("fan 7 on");
} else {
fan[1] = 48;
fan[7] = 48;
}
// zone 1 - 2
if (b[1] > b[2]){
fan[3] = 49;
fan[4] = 48;
println("fan 3 on");
} else if (b[2] > b[1]){
fan[3] = 48;
fan[4] = 49;
println("fan 4 on");
} else {
fan[3] = 48;
fan[4] = 48;
}
// zone 3 - 4
if (b[3] > b[4]){
fan[5] = 49;
fan[6] = 48;
println("fan 5 on");
} else if (b[4] > b[3]){
fan[5] = 48;
fan[6] = 49;
println("fan 6 on");
} else {
fan[5] = 48;
fan[6] = 48;
}
// zone 2 - 4
Processing
if (b[2] > b[4]){
fan[2] = 49;
fan[8] = 48;
println("fan 2 on");
} else if (b[4] > b[2]){
fan[2] = 48;
fan[8] = 49;
println("fan 8 on");
} else {
fan[2] = 48;
fan[8] = 48;
}

for (int n=1; n<9; n++){


fanoutput += char(fan[i]);
}
myPort.write(fanoutput);
for (int n=1; n<5; n++){
print(b[n]+",");
}
println(".");
println(fanoutput);
fanoutput = "";
delay(5000);
}
satimg = Gif.getPImages(this, "http://sirocco.accuweather.com/sat_mosaic_400x300_public/rs/isarNE.gif");
}

Você também pode gostar