View Single Post
Old 01-30-11, 02:53 AM   #48
strider3700
Master EcoRenovator
 
Join Date: Dec 2008
Location: Vancouver Island BC
Posts: 745
Thanks: 23
Thanked 37 Times in 30 Posts
Default

ok the code was relatively simple to fix but my quick and dirty hack is ugly as sin. I just had to create a second instance of everything...

Code:
// Data wire is plugged into port 22 on the Arduino
#define ONE_WIRE_BUS 22
#define ONE_WIRE_BUS2 23
#define TEMPERATURE_PRECISION 9
#define delayTime 2000     // the delay before restarting the loop


// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
OneWire oneWire2(ONE_WIRE_BUS2);
int woodStoveCurrent = 0;
int hotWaterCurrent1 =1;
int hotWaterCurrent2 =2;
int baseline =0;

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);
DallasTemperature sensors2(&oneWire2);
// arrays to hold device addresses
DeviceAddress s1, s2, s3,s4, s5, s6, s7, s8, s9, s10;

void setup(void)
{
  // start serial port
  Serial.begin(9600);
  delay(1000);
  // Start up the library
  sensors.begin();
  sensors2.begin();
this of course messes everything up further down since printTemperatures wants sensors not sensors2... I'll have to write something smart one day for now it works kinda.

The current issue is the sensors on the end of the long wire both report back their address's but they give a temperature of 85 which is the default for the sensor. It's 1 in the morning so I'll have to figure it out tomorrow.

Also on the screwed up front after 15 years of service my $10 crap soldering iron from radioshack gave up tonight. If nicely electrocuted me to tell me it was going and now doesn't heat up at all.

<edit> OK I found the issue on the 85 from the sensor It was because of my crap hack and having sensors and sensors2. I forgot to tell sensor2 to request the temperatures... some serious thought will be required and then I'll refactor the entire arudino code to make it far less horrible to use. It should be doing a bunch more things like automatically knowing how many sensors are on the bus and handling them all rather then hardcoded calls to each and so on. One day... </edit>

Last edited by strider3700; 01-30-11 at 03:15 AM.. Reason: fixed partially
strider3700 is offline