tweet-a-watt
in
Integration and Hardware
•
3 years ago
Has anyone been able to figure out how to use data from a tweet-a-watt directly in processing? This page
http://www.faludi.com/code/xbee-api-library-for-processing/
has gotten me close to being able to do so, but the data returned in processing is not in a usable format - I just want to have the watts coming in to processing so I can visually represent this data. Right now I'm using the python file as set-up following this tutorial
http://www.ladyada.net/make/tweetawatt/software.html
but it crashes often and the system I've devised to have processing read the csv file output by python is not ideal. Here's the processing program I've come up with to continually update the csv file with wattage info
String[] consumption;
int index = 1;
void setup() {
consumption = loadStrings("powerdatalog.csv");
frameRate(0.20);
}
void draw() {
if (index < consumption.length) {
String[] allinfo = split(consumption[index], '\t');
if (allinfo.length == 1) {
float x = float(allinfo[0]);
String w = str(x);
String[] avgwatt = splitTokens(allinfo[0], ", ");
float consumptionWatt = float(avgwatt[5]);
println(consumptionWatt);
}
index = index + 1;
}
}
If anyone has any thoughts, they would be much appreciated. Thanks.
http://www.faludi.com/code/xbee-api-library-for-processing/
has gotten me close to being able to do so, but the data returned in processing is not in a usable format - I just want to have the watts coming in to processing so I can visually represent this data. Right now I'm using the python file as set-up following this tutorial
http://www.ladyada.net/make/tweetawatt/software.html
but it crashes often and the system I've devised to have processing read the csv file output by python is not ideal. Here's the processing program I've come up with to continually update the csv file with wattage info
String[] consumption;
int index = 1;
void setup() {
consumption = loadStrings("powerdatalog.csv");
frameRate(0.20);
}
void draw() {
if (index < consumption.length) {
String[] allinfo = split(consumption[index], '\t');
if (allinfo.length == 1) {
float x = float(allinfo[0]);
String w = str(x);
String[] avgwatt = splitTokens(allinfo[0], ", ");
float consumptionWatt = float(avgwatt[5]);
println(consumptionWatt);
}
index = index + 1;
}
}
If anyone has any thoughts, they would be much appreciated. Thanks.
2