Wednesday, November 4, 2009

Prototype #7



GOAL: Connect several breadboards to the Arduino board and have it react to the Pachube feeds.

PROCESS: Connected second breadboard, created two simple circuits and modified the script.

RESULT: Both LEDs turn on and change intensity.

CODE:

import processing.serial.*;
import cc.arduino.*;

import eeml.*;

Arduino arduino;
int myValue;

DataIn dIn;

void setup()
{
size(245,245);
println(Arduino.list());
arduino = new Arduino(this, Arduino.list()[1], 115200);
dIn = new DataIn(this,"http://www.pachube.com/api/feeds/1816.xml", "cb5ac556b416f518567ee5dfec0d9af7cad7a444b52e5e662e796205ca63f7f7", 5000);
dIn = new DataIn(this,"http://www.pachube.com/api/feeds/2251.xml", "cb5ac556b416f518567ee5dfec0d9af7cad7a444b52e5e662e796205ca63f7f7", 5000);
}
void draw()
{
println(myValue);
arduino.analogWrite(9,myValue);
arduino.analogWrite(10,myValue);
}
void onReceiveEEML(DataIn d){
float remoteValue = d.getValue(1);
float remoteValue2 = d.getValue(2);
myValue = int(remoteValue) / 10;
myValue = int(remoteValue) / 10;
}


Labels: , , ,


Comments:

Post a Comment





<< Home

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