Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / Re: help adapt code from atmega328 to attiny85 on: March 12, 2014, 01:44:57 pm
what if i only use one analog pin instead of dual channel and reduce the samples? do you think it would make any difference.

the only avr chips i have are attiny85's; atmega328p-pu's; atmega32u4's; and a big ass1284p.
i guess i could build a board with a 32u4 with built in usb support so i dont have to modify code, but that sure is a lot of wasted IO's just to read the values of 2 analog pins.

anyone with a suggestion
2  Using Arduino / Programming Questions / help adapt code from atmega328 to attiny85 on: March 12, 2014, 01:19:54 pm
im working on a small avr oscillocope that use the analog pin to read the voltage and display it on the pc.
here is the base hardware that im using.
http://yveslebrac.blogspot.com/2008/10/cheapest-dual-trace-scope-in-galaxy.html
it works for the hardware but i cant get the software to work.

windows recognizes it as a usb game controller and the UI is in another language. it also may not work on win7x64 (which is what im running)


i also built up a quick and dirty oscilloscope with the arduino uno.
https://code.google.com/p/xoscillo/
it is detected as a COM port and has nice software



HERE IS WHAT I WANT....
i want to use the board that i made with the attiny85 paired with usb to work on the other software and recognized as a COMM port.

is this possible and where would i start.

code for the attiny85 (HEX) http://www.reality.be/files/main.hex
code for the arduino uno (INO)
this is the code i want to adapt to use with the attiny85 chip and vusb.

Code:
// Scopino - Scope application
// By Amit Zohar
// Ver 1.0, 10/9/12
const int maxSamples = 500;
const int maxSampChan = maxSamples/2;
const int maxChannel = 2;
word samples[maxSamples];
int channel=1, timeRes=200, timeStep=1, voltAmp=2, voltCoup=0, trigVal=0, trigMode=0;
//unsigned long times[maxSamples]; // Time stamp debugging
const int pinSquare=2;

void setup() {
  Serial.begin(115200); // Fast IO
  Serial.setTimeout(10); // Quick read
  pinMode(pinSquare, OUTPUT); // Square wave 100Hz
  tone(pinSquare, 100);
}

///////////////////////// Process serial input
// Protocol: *C<channel>T<time resolution>S<samples division>V<voltage amp.>P<voltage coupling>G<trigger value>H<trigger mode>E
// (C) Channel: 1-2
// (T) Time resolution: at least 200uSec per channel
// (S) Samples division: divide # of samples for speed
// (V) Voltage amp.: 1=amplified (H/W), 2=0-5V as-is, 3=0-50V attenuated by 10 (H/W)
// (P) Voltage coupling: 0=DC, 1=AC (H/W)
// (G) Trigger value: value needed to be crossed for trigger (0-1023)
// (H) Trigger mode: 0=free run, 1=positive slope, 2=negative slope, 3=both slopes
// Example: *C10T5S333V8P1G1H2E
// Default: *C1T200S1V2P0G0H0E
void getCommand()
{
  const int recBuf=64;
  if (Serial.available() > 0) // Incoming chars?
  {
    delay(10); // Let all chars arrive
    char recRare[recBuf];
    int chars = Serial.readBytes(recRare,recBuf); // Get buf to String
    recRare[chars] = 0;
    String rec = recRare;
    if (rec.startsWith("*")) // Valid frame start
    {
      //      Serial.write('*');
      int posC = rec.indexOf("C");
      int posT = rec.indexOf("T");
      int posS = rec.indexOf("S");
      int posV = rec.indexOf("V");
      int posP = rec.indexOf("P");
      int posG = rec.indexOf("G");
      int posH = rec.indexOf("H");
      int posE = rec.indexOf("E");
      String prm;
      char ca[recBuf];
      prm = rec.substring(posC+1,posT); // Channel
      prm.toCharArray(ca,sizeof(ca));
      channel = atoi(ca);
      prm = rec.substring(posT+1,posS); // Time resolution
      prm.toCharArray(ca,sizeof(ca));
      timeRes = atoi(ca);
      prm = rec.substring(posS+1,posV); // Samples division
      prm.toCharArray(ca,sizeof(ca));
      timeStep = atoi(ca);
      prm = rec.substring(posV+1,posP); // Voltage amp.
      prm.toCharArray(ca,sizeof(ca));
      voltAmp = atoi(ca);
      prm = rec.substring(posP+1,posG); // Voltage coup.
      prm.toCharArray(ca,sizeof(ca));
      voltCoup = atoi(ca);
      prm = rec.substring(posG+1,posH); // Trigger value
      prm.toCharArray(ca,sizeof(ca));
      trigVal = atoi(ca);
      prm = rec.substring(posH+1,posE); // Trigger mode
      prm.toCharArray(ca,sizeof(ca));
      trigMode = atoi(ca);
      //      Serial.print(channel); // Debugging
      //      Serial.print(',');
      //      Serial.print(timeRes);
      //      Serial.print(',');
      //      Serial.print(timeStep);
      //      Serial.print(',');
      //      Serial.print(voltAmp);
      //      Serial.print(',');
      //      Serial.print(voltCoup);
      //      Serial.print(',');
      //      Serial.print(trigVal);
      //      Serial.print(',');
      //      Serial.print(trigMode);
      //      Serial.print(',');
    }
  }
}

///////////////////////// Sample
unsigned long sample()
{
  // Trigger check
  int preSamp=-1, curSamp;
  const int waitTrig = 1000;
  for  (int i=0; i<=waitTrig; i++) // Try to catch the trigger
  {
    if ( trigMode == 0) break; // Free run
    curSamp = analogRead(0);
    if (preSamp != -1) // We have previous sample
    {
      boolean pos = false, neg = false; // Calculate which slope it is
      if (preSamp < trigVal && curSamp >= trigVal) pos = true;
      if (preSamp >= trigVal && curSamp < trigVal) neg = true;
      if ( trigMode == 1 && pos) break; // Positive slope
      if ( trigMode == 2 && neg) break; // Negative slope
      if ( trigMode == 3 && (pos || neg)) break; // Both
    }
    preSamp = curSamp; // Save last sample
    if (i == waitTrig) return 0; // No trigger, do some other work
  }

  // Sampling
  //  unsigned long timeSamp; // Time stamp debugging
  unsigned long samp1, timeFrom1, nextSamp;
  int rawSamp;
  samp1 = micros(); // Sampling start
  for ( unsigned long i=0;i<maxSamples/timeStep;i++) // Sampling loop
  {
    //    timeSamp = micros(); // Time stamp debugging
    //    times[i] = timeSamp-firstSamp; // Time stamp debugging
    for (int ch=0; ch<channel; ch++) // Sample all channels (reuse buffer for channel 2)
      samples[i+maxSampChan*ch] = analogRead(ch);

    nextSamp = timeRes*(i+1); // Time for next sample
    do timeFrom1 = micros()-samp1; // Wait for next sample time
    while (timeFrom1 < nextSamp);
  }
  return timeFrom1;
}

///////////////////////// Send output
// Protocol: *Channel>Time resolution:Sample1,Sample2...,
void sendSamples(unsigned long sampTime)
{
  String samp;
  for (int ch=0; ch<channel; ch++) // Sample all channels
  {
    //    Serial.print("*1:");
    Serial.print("*"); // Channel
    Serial.print(ch+1);
    Serial.print(":");

    Serial.print(sampTime/maxSamples); // Time resolution
    Serial.print(">");
    for (int i=0;i<maxSamples/timeStep;i++) // Samples
    {
      //    Serial.print(times[i]); // Time stamp debugging
      //    Serial.print('=');
      samp =  String(samples[i+maxSampChan*ch], HEX); // Send in HEX format   
      Serial.print(samp);
      Serial.print(',');
    }
    Serial.println();
  }
}

void loop(){
  getCommand(); // We listen to the master program
  unsigned long sampTime = sample(); // We sample
  if (sampTime > 0) sendSamples(sampTime); // We have samples
}


3  Using Arduino / General Electronics / Re: help with code to replace input from pot to a rotary encoder on: February 21, 2014, 09:28:01 am
great idea..

i think this should give me a range of 25 degrees between 60 - 85


Code:
setTemp = sensorValue / 40.96+60;

thank you.
sometimes you stare at something for so long you overlook the obvious
4  Using Arduino / General Electronics / help with code to replace input from pot to a rotary encoder on: February 20, 2014, 05:32:42 pm
im building a hvac thermostat controller and currently im using a 10k pot to set the desired temp on A0 pin. the only one's i have are single turn which means very small movements to set temp.
i do have a few rotary encoders begging to have some solder on the legs.

how would i modify the current code below to accept input from an encoder.....
Code:
/* A fair portion of the code here is from Arduinotronics and I would have been lost with out it. This is my first “big” Arduino project. So, there is probably a ton of things that can be improved on and tweeked. I would love to know your thoughts and see your improvements! If you would like to share your thoughts with me on this please email me at modsbyus at modsbyus dot com and make the subject line RE: Arduino Thermostat Thoughts, or write a comment on the tutorial at http://www.modsbyus.com/diy-arduino-thermostat. Required library for the DS18B20 can be downloaded here.. http://192.40.125.129/public.php?service=files&file=/admin/files/Modsbyus/libraries.rar/ */
#include <OneWire.h> /*This temperature sensor requires a 4.7k Ohm resistor across its pins 2 and three!!!! */
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
int sensorPin = A0; // select the input pin for the 10K potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
int setTemp = 0; // variable to store temp desired
int SSRCPin = 5; //Turn on A/C unit
int SSRHPin = 6; //Turn on heat (electric or gas)
int hcLED = 4; //indicator for Cooling mode
int SwitchPin = 1; // To switch between Cooling and Heating
int SSRFan = 7; // To turn on and off the air handler fan
float currentTemp = 0; //Store the current tempurature
// LCD Wires from LCD/to Arduino and other components
// 1 to GND
// 2 to 5V
// 3 to Trimmer Pot Reference Pin
// 4 to Arduino Pin 9
// 5 to GND
// 6 to Arduino Pin 10
// 11 to Arduino Pin 11
// 12 to Arduino Pin 12
// 13 to Arduino Pin 13
// 14 to Arduino Pin 8
// 15 to 5V
// 16 to GND
//Heat relay to Arduino pin 4
//Cooling relay to Arduino pin 5
//Fan relay to Arduino pin 6
//LEDs relay to Arduino pin 7
//DS18B20 to Arduino pin 2
//Heat/Cool switch to Arduino pin 1
LiquidCrystal lcd(9, 10, 11, 12, 13, 8);
/*This temperature sensor requires a 4.7k Ohm resistor across its pins 2 and three!!!! Thats the middle pin and the VDD pin */
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
DeviceAddress insideThermometer = { 0x28, 0x3F, 0x2B, 0x77, 0x03, 0x00, 0x00, 0x95 };
// DeviceAddress outsideThermometer = { 0×28, 0×20, 0×04, 0xA8, 0×02, 0×00, 0×00, 0x4D };
void setup(void)
{
// Start up the library
sensors.begin();
// set the resolution to 9 bit (good enough?)
sensors.setResolution(insideThermometer, 9);
// sensors.setResolution(outsideThermometer, 9);
lcd.begin(16,2); // columns, rows. use 16,2 for a 16×2 LCD, etc.
pinMode(SSRFan, OUTPUT); //set air handler fan pin as output
digitalWrite(SSRFan, LOW);//Set the fan relay pin normally low (off)
pinMode(SSRHPin, OUTPUT);//Set the heat relay pin as an output
digitalWrite(SSRHPin, LOW);//Set the heat relay pin as normally low (off)
pinMode(SSRCPin, OUTPUT);//Set the cooling relay pin as an output
digitalWrite(SSRCPin, LOW);//Set the cooling relay pin as normally low (off)
pinMode(hcLED, OUTPUT);//Set the indicator LED pin as an output
digitalWrite(hcLED, LOW);//Set the LED indicator pin as normally low (cooling indication)
pinMode(SwitchPin, INPUT);//Set the switch pin as an input
}
void printTemperature(DeviceAddress deviceAddress)
{
sensors.requestTemperatures(); //Get temperature from DS18B20
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
lcd.print("Error");
} else {
// lcd.print(tempC);
// lcd.print(“/”);
currentTemp = (DallasTemperature::toFahrenheit(tempC));
lcd.print(currentTemp);
}
}
void loop(void)
{
delay(500);
sensorValue = analogRead(sensorPin); //Set the variable ‘sensorValue’ as and analog read of the sensor pin
setTemp = sensorValue / 10.24; //Gives us a set temp range between 0 and 99 degrees
lcd.clear(); // start with a blank screen
lcd.setCursor(0,0); //Set the cursor to the 1st position on the 1st line
lcd.print("Current:"); //Print the word ‘Current:’
lcd.setCursor(0,1);//Set the cursor to the 1st position on the second line
lcd.print("Set:"); //Print the word ‘Set:’
//lcd.setCursor(0,3);
//lcd.print(“Heat: “);
 
lcd.setCursor(8,0);// Set the cursor to position 8 on the 1st line
printTemperature(insideThermometer);//Print the temperature read from the DS18B20
lcd.setCursor(6,1);//Set the cursor to the position 6 on the 2nd line
lcd.print(setTemp); //Print the value read from the potentiometer
//lcd.setCursor(7,3);
//lcd.print(heat);
//Cooling Mode
int val = digitalRead(SwitchPin) ;// val represents digitalRead(SwitchPin);
/* If the value of is equal to 1 (high) then make hcLED low (off) which sets the relay in a normally closed state. Hence, turning on the blue LED. */
if (val == 1)
{
digitalWrite(hcLED, LOW);//Set the heating/cooling LED indicator to LOW if ‘val’ is equal to 1
}
/* If the SwitchPin reads 1 and the current temperature is greater than the set temperature (if its hot) turn on the A/C and internal fan */
if (val == 1 && (currentTemp > setTemp))
{
digitalWrite(SSRFan, HIGH);//Set the fan relay high
digitalWrite(SSRHPin, LOW);//Set the heat relay low
digitalWrite(SSRCPin, HIGH);//Set the cooling relay high
}
/* Otherwise, if the SwitchPin reads 1 and the current temperature is less than the set temperature (the set temperature has been reached), turn off the A/C and internal fan */
else if (val == 1 && (currentTemp < setTemp))
{
digitalWrite(SSRCPin, LOW);//Set the cooling relay low
digitalWrite(SSRFan, LOW);//Set the fan relay low
}
// Heating Mode
/* If the value of is 0 then make hcLED HIGH (on) which sets the relay in a normally open state. Hence, turning on the RED LED */
if (val == 0)
{
digitalWrite(hcLED, HIGH);//Set the heating/cooling led high
}
/* If the SwitchPin reads 0 and the current temperature is less than the set temperature (if its cold) turn on the HEAT and internal fan */
if (val == 0 && (currentTemp < setTemp))
{
digitalWrite(SSRFan, HIGH);//Set the fan relay high
digitalWrite(SSRCPin, LOW);//Set the cooling relay low
digitalWrite(SSRHPin, HIGH);//Set the heat relay high
}
/* If the SwitchPin reads 0 and the current temperature is greater than the set temperature (the set temperature has been reached) turn off the HEAT and internal fan */
else if (val == 0 && (currentTemp > setTemp))
{
digitalWrite(SSRHPin, LOW);//Set the heat relay low
digitalWrite(SSRFan, LOW);//Set the fan relay low
}
}


the encoders are BOURNS PEC12R-4050F-S0012 if it matters
5  Using Arduino / General Electronics / Re: OptoIsolator to switch low current 24VAC on: February 20, 2014, 04:16:55 pm
ok thats what i planned to do with the power for the uC. either a bridge rectifier and/or buck regulator.

but for switching i think i may be better off using SPST relays. i can use the optos to switch power to the coil of the relay and pass 24VAC through the legs of the relay.

im trying to turn on / off the HVAC control lines so i wouldnt be able to use the above suggestion as it would be DC output and the HVAC runs off of AC


thnaks alot but im seeing what i originally planned for is not working out. looks like i have clicking relays in my future.....
or maybe triacs...
6  Using Arduino / General Electronics / OptoIsolator to switch low current 24VAC on: February 20, 2014, 10:08:46 am
i have some TLP781F optoisolators left over from a previous project.
Datasheet::http://www.es.co.th/Schemetic/PDF/TLP781_TLP781F.PDF

i am building a controller for a HVAC home unit. can i use these to switch AC current at low I.
i don't have any SSR's on hand and am not crazy about the sound of the relays clicking. not in this project at least.

i have used these opto's before and they work just fine. i just dont know if i can do AV voltage with them.
if not, im open to different suggestions.
7  Using Arduino / Project Guidance / Re: read li-ion battery voltage on: September 03, 2013, 12:45:50 pm
nevermind. loose connection on the BATT GND to the arduino GND pin. that was what was causing the bad readings. connect the BATT + to A0 and the BATT - to GND.
open serial monitor and boom. thx
8  Using Arduino / Project Guidance / Re: read li-ion battery voltage on: September 03, 2013, 12:05:50 pm
i just thought it would be simple since the arduino is 5v and we are measuring at max 4.2v. (no voltage divider needed) so in my head connect the battery to a ADC (A0) pin and print out voltage value on serial monitor.
9  Using Arduino / Project Guidance / Re: read li-ion battery voltage on: September 03, 2013, 11:41:13 am
it is connected to the A0 pin with the + and GND with the - of the BATT
fully charged is 4.2V
Normal voltage is 3.7V



what is the right way to do it. the way im doing it MIGHT not be right.
10  Using Arduino / Project Guidance / Re: read li-ion battery voltage on: September 03, 2013, 08:52:30 am
ok the serial monitor displays random values scrolling down the screen instead of a constant value    smiley-lol
11  Using Arduino / Project Guidance / read li-ion battery voltage on: September 03, 2013, 08:38:20 am
ok. This should be a simple task to accomplish, but im having trouble with it.
all im trying to do i read the voltage from a battery on the arduino. when im using the following code

Code:
void setup() {
  Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(A0);
    float voltage = sensorValue * (5.0 / 1023.0);
   Serial.println(voltage);

reading the arduino 5v it works fine. open up serial monitor and nice flow of voltage values.
when i try to use the battery it goes nuts.
i did change the
Code:
float voltage = sensorValue * (5.0 / 1023.0);
to
Code:
float voltage = sensorValue * (4.2 / 1023.0);
but that didnt work.

im assuming it has something to do with reference voltage but need some guidance in the right direction.
or is there another way to do this simply.
ive got a uno and reading a standard 18650 li-ion battery (actually 2x18650 in parallel but the voltage is the same).
12  Using Arduino / Project Guidance / Re: ARDUINO POOL ALARM... on: June 12, 2013, 04:30:53 pm
i realize that this is no full proof idea or an alternative to good parenting and supervision. it is though a secondary or third defense. ive got a good idea for the laser barrier setup and i believe it will work with 2 beams (one beam at ~1.5' and another at ~4.5' to try to cut down on false positives) but will a PIR work better or maybe a IR detector. what do ya'll think. (i can say "ya'll; i'm in Alabama)
13  Using Arduino / Project Guidance / ARDUINO POOL ALARM... on: June 12, 2013, 02:49:42 pm
just like all new dad's, we are good at worrying. the topic that has been heavy for me is the in ground pool.

been looking around for a few days about swimming pool alarms.

i am looking to build a DIY pool alarm. problem is i just dont know what detection method would be best. some options are: IR, PIR, and laser. i have a strong background in lasers and can build any electronics just rough on the programming side. ( im working on that)

the pool is 15'x32' and just under 25000 gallons. getting power to the electronics is not an issue. just trying to figure out how to detect a child falling into a pool. any ideas, suggestion, directions or critique is welcomed....
14  Using Arduino / Programming Questions / Re: HD74480 LCD with DS18B20 problem on: October 14, 2012, 01:51:40 am
ok started over with the programming. now im using ...

Quote
// LCD Thermostat
// www.hacktronics.com

#include <OneWire.h>
#include <LiquidCrystal.h>

// Connections:
// rs (LCD pin 4) to Arduino pin 12
// rw (LCD pin 5) to Arduino pin 11
// enable (LCD pin 6) to Arduino pin 10
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
int backLight = 13;    // pin 13 will control the backlight

OneWire  ds(smiley-cool;        // ds18b20 pin #2 (middle pin) to Arduino pin 8

byte i;
byte present = 0;
byte data[12];
byte addr[8];
 
int HighByte, LowByte, SignBit, Whole, Fract, TReading, Tc_100, FWhole;

void setup(void) {
  pinMode(backLight, OUTPUT);
  digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
  lcd.begin(2,16);              // rows, columns.  use 2,16 for a 2x16 LCD, etc.
  lcd.clear();                  // start with a blank screen
  lcd.setCursor(0,0);           // set cursor to column 0, row 0
 
    if ( !ds.search(addr)) {
      lcd.clear(); lcd.print("No more addrs");
      delay(1000);
      ds.reset_search();
      return;
  }

  if ( OneWire::crc8( addr, 7) != addr[7]) {
      lcd.clear(); lcd.print("CRC not valid!");
      delay(1000);
      return;
  }
}

void getTemp() {
  int foo, bar;
 
  ds.reset();
  ds.select(addr);
  ds.write(0x44,1);
 
  present = ds.reset();
  ds.select(addr);   
  ds.write(0xBE);

  for ( i = 0; i < 9; i++) {
    data = ds.read();
  }
 
  LowByte = data[0];
  HighByte = data[1];
  TReading = (HighByte << smiley-cool + LowByte;
  SignBit = TReading & 0x8000;  // test most sig bit
 
  if (SignBit) {
    TReading = -TReading;
  }
  Tc_100 = (6 * TReading) + TReading / 4;    // multiply by (100 * 0.0625) or 6.25
  Whole = Tc_100 / 100;          // separate off the whole and fractional portions
  Fract = Tc_100 % 100;
  if (Fract > 49) {
    if (SignBit) {
      --Whole;
    } else {
      ++Whole;
    }
  }

  if (SignBit) {
    bar = -1;
  } else {
    bar = 1;
  }
  foo = ((Whole * bar) * 18);      // celsius to fahrenheit conversion section
  FWhole = (((Whole * bar) * 18) / 10) + 32;
  if ((foo % 10) > 4) {            // round up if needed
       ++FWhole;
  }
}

void printTemp(void) {
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Temp is: ");
  lcd.setCursor(0,1);   
 
  if (SignBit) { 
     lcd.print("-");
  }
  lcd.print(Whole);
  lcd.print(" C / ");
  lcd.print(FWhole);
  lcd.print(" F");
}

void loop(void) {
  getTemp();
  printTemp();
  delay(1000);
}


and everything is working fine except the lcd always says "Temp is: 85C / 185F "
no matter what i do am i overlooking something in the coding
15  Using Arduino / Programming Questions / DS18B20 temperature sensor problem on: October 13, 2012, 05:30:31 pm
i have 2 18B20 temp sensors ...

Found '1-Wire' device with address:
0x28, 0xC2, 0x39, 0x77, 0x03, 0x00, 0x00, 0x52
Found '1-Wire' device with address:
0x28, 0x3F, 0x2B, 0x77, 0x03, 0x00, 0x00, 0x95

1 HD74480 LCD  and an arduino uno

i can make each of them work seperatly (lcd hello world and 18B20 read temp through serial monitor)

i cant get it to work together.
here is the code im using...

Quote
// This Arduino sketch reads DS18B20 "1-Wire" digital
// temperature sensors.
// Tutorial:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-tutorial.html

#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

int backLight = 13; // pin 13 will control the backlight

// Data wire is plugged into pin 8 on the Arduino
#define ONE_WIRE_BUS 8

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

// Assign the addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html

DeviceAddress insideThermometer = { 0x28, 0xC2, 0x39, 0x77, 0x03, 0x00, 0x00, 0x52 };
DeviceAddress outsideThermometer = { 0x28, 0x3F, 0x2B, 0x77, 0x03, 0x00, 0x00, 0x95 };

void setup(void)
{
// Start up the library
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(insideThermometer, 10);
sensors.setResolution(outsideThermometer, 10);

pinMode(backLight, OUTPUT);
digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
lcd.begin(16,2); // columns, rows. use 16,2 for a 16x2 LCD, etc.
lcd.clear(); // start with a blank screen
}

void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC();
if (tempC == -127.00) {
lcd.print("Error");
} else {
lcd.print(tempC);
lcd.print("/");
lcd.print(DallasTemperature::toFahrenheit(tempC));
}
}

void loop(void)
{
delay(2000);
sensors.requestTemperatures();
lcd.setCursor(0,0);
lcd.print("In: ");
printTemperature(insideThermometer);
lcd.setCursor(0,1);
lcd.print("Out: ");
printTemperature(outsideThermometer);
}



this is the error im getting

Quote
sketch_oct13a:7: error: variable or field 'printTemperature' declared void
sketch_oct13a:7: error: 'DeviceAddress' was not declared in this scope
sketch_oct13a:20: error: no matching function for call to 'DallasTemperature::DallasTemperature(OneWire*)'
C:\Users\Chad\Downloads\arduino-0023\arduino-0023\libraries\DallasTemperature/DallasTemperature.h:48: note: candidates are: DallasTemperature::DallasTemperature(NewOneWire&, uint8_t, StratBase*)
C:\Users\Chad\Downloads\arduino-0023\arduino-0023\libraries\DallasTemperature/DallasTemperature.h:20: note:                 DallasTemperature::DallasTemperature(const DallasTemperature&)
sketch_oct13a:26: error: 'DeviceAddress' does not name a type
sketch_oct13a:27: error: 'DeviceAddress' does not name a type
sketch_oct13a.cpp: In function 'void setup()':
sketch_oct13a:34: error: 'class DallasTemperature' has no member named 'setResolution'
sketch_oct13a:34: error: 'insideThermometer' was not declared in this scope
sketch_oct13a:35: error: 'class DallasTemperature' has no member named 'setResolution'
sketch_oct13a:35: error: 'outsideThermometer' was not declared in this scope
sketch_oct13a.cpp: At global scope:
sketch_oct13a:43: error: variable or field 'printTemperature' declared void
sketch_oct13a:43: error: 'DeviceAddress' was not declared in this scope

any guidance is appreciated.

please dont do the " just use the search function of the forum" i already have as well as crawled all over the net searching before i posted.
Pages: [1] 2