Sei sulla pagina 1di 4

Park Squid Pod

A pavilion that seeks to create a pleasant resting spot in response to the weather.
Processing Script:
// Toronto
String toronto[];// Array of all the lines in the file
toronto= loadStrings("http://weather.yahooapis.com/forecastrss?p=CAXX0504&u=f");//loading the data from file to lines array
String toline28 =toronto[28];
// println (totempIndex);
int totempIndex=toline28.indexOf(
totempIndex toline28 indexOf("temp");
temp );
String totempAsString=toline28.substring(60,62);
int totempAsInt=int(totempAsString);
//println (totempAsInt);
int totempAsInt2=((totempAsInt‐32)*5/9);
println (totempAsInt2);

// Mumbai
String mumbai[];// Array of all the lines in the file
String mumbai[];// Array of all the lines in the file
mumbai= loadStrings("http://weather.yahooapis.com/forecastrss?p=INXX0026&u=f");//loading the data from file to lines array
String mbline28 =mumbai[28];
// println (mbtempIndex);
int mbtempIndex=mbline28.indexOf("temp");
String mbtempAsString=mbline28.substring(51,53);
int mbtempAsInt=int(mbtempAsString);
//println (mbtempAsInt);
int mbtempAsInt2=((mbtempAsInt‐32)*5/9);
mbtempAsInt2=((mbtempAsInt 32)*5/9);
println (mbtempAsInt2);

// Murmansk
String murmansk[];// Array of all the lines in the file
murmansk= loadStrings("http://weather.yahooapis.com/forecastrss?p=RSXX0452&u=f");//loading the data from file to lines array
String muline28 =murmansk[28];
int mutempIndex=muline28.indexOf("temp");
// println (mutempIndex);
// println
String mutempAsString=muline28.substring(60,62);
int mutempAsInt=int(mutempAsString);
// println (mutempAsInt);
int mutempAsInt2=((mutempAsInt‐32)*5/9);
println (mutempAsInt2);

// Serial Port Selection
import processing.serial.
import processing serial *;;
// The serial port:
Serial myPort;
// List all the available serial ports:
println(Serial.list());

// Export to Arduino
myPort = new Serial(this, Serial.list()[0], 9600);
int[] tempuratures = { totempAsInt2, mbtempAsInt2, mutempAsInt2 };
int[] tempuratures = { totempAsInt2 mbtempAsInt2 mutempAsInt2 };

for (int i = 0; i < 3; i = i+1) {


myPort.write(tempuratures[i]);
}
println (tempuratures);
Arduino Script:
void setup()
{
pinMode(13, OUTPUT); // Specify Arduino Pin number and output/input mode
pinMode(12, OUTPUT);
Serial.begin(9600);

int tempuratures [4] = {Serial.read()};

void loop()
{

for (int
for (int i=0; i
i=0; i = 3; i++){
= 3; i++){
tempuratures [i] = (tempuratures[i], DEC);

if (tempuratures [i] <10) {

digitalWrite(13, HIGH); // Turn on Pin 13 sending a HIGH Signal
digitalWrite(12, LOW);
delay(3000);
digitalWrite(13 LOW);
digitalWrite(13, LOW);
digitalWrite(12, LOW);
delay(1000);
digitalWrite(12, HIGH); // Turn on Pin 13 sending a HIGH Signal
digitalWrite(13, LOW);
delay(3000);
}
else if (tempuratures [i] >20) {
digitalWrite(13 HIGH); // Turn on Pin 13 sending a HIGH Signal
digitalWrite(13, HIGH); // Turn on Pin 13 sending a HIGH Signal
digitalWrite(12, LOW);
delay(500);
digitalWrite(13, LOW);
digitalWrite(12, LOW);
delay(5000);
digitalWrite(12, HIGH); // Turn on Pin 13 sending a HIGH Signal
digitalWrite(13, LOW);
delay(500); 
delay(500);
}
else 
{
digitalWrite(13, HIGH); // Turn on Pin 13 sending a HIGH Signal
digitalWrite(12, LOW);
delay(1000);
digitalWrite(13, LOW);
digitalWrite(12 LOW);
digitalWrite(12, LOW);
delay(1000);
digitalWrite(12, HIGH); // Turn on Pin 13 sending a HIGH Signal
digitalWrite(13, LOW);
delay(1000);
}
}
}

Potrebbero piacerti anche