We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Pachube using Pachuino (Read 912 times)
Pachube using Pachuino
Nov 14th, 2008, 7:03pm
 
First of all sorry if the question seems little noobish but was trying to input temperature and humidity data to the pachube (http://www.pachube.com) still trying to figuring out where mm i making mistake : basically i have uploaded firmata to the arduino and working with the processing with the pachuino code, the only problem i have is with the values which comes to zero can anybody help me with the code.

all the connection are made on the analog input : temperature onto analog input 3 and humidity onto analog input 5


the processing code:

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

Pachuino p;

int analogPin = 3;
int analogputpin = 5;
int analogValue = 0;
int tempc = 0;
int maxi = 0, mini = 100;
int i;
int inByte;

float humi = 0;
float prehum = 0;
float humconst = 0;
float truehum = 0;
float pretruehum = 0;  
long pretruehumconst = 0;                      
long valb = 0;

void setup(){  

   p = new Pachuino(this, Arduino.list()[1], 9600);  
   p.manualUpdate("http://www.pachube.com/api/1185.xml");  
   p.setKey("MY PACHUBE API ");    
   
   // local sensors    
   p.addLocalSensor("analogPin", 0, "temperature");
   p.addLocalSensor("analogPin", 1, "humidity");

}

void draw(){
 /*
  for(i = 0;i<=7;i++){ // gets 8 samples of temperature
  int inByte = (analogRead(analogin) * 500) / 1024;
 
  if(tempc > maxi) {maxi = tempc;} // set max temperature
  if(tempc < mini) {mini = tempc;} // set min temperature

  valb = analogRead(putPin); // humidity calculation
  prehum = (valb/5);
  humconst = (0.16/0.0062);
  humi = prehum - humconst;
  pretruehumconst = 0.00216*tempc;
  pretruehum =  1.0546-pretruehumconst;
  truehum = humi/pretruehum ;
 
  Serial.print(tempc,DEC);
  */
  float tempVal1 = p.localSensor[1].value;
  String tempTags1 = p.localSensor[0].tags;
  p.analogWrite(3, 5);
  p.analogWrite(9, p.localSensor[1].value * 10);
}

// you don't need to change any of these

void onReceiveEEML(DataIn d){  
   p.updateRemoteSensors(d);
}
void onReceiveRequest(DataOut d){
   p.updateLocalSensors(d);
}


Page Index Toggle Pages: 1