Go Down

Topic: I Keep getting errors when I try to upload (Read 3797 times) previous topic - next topic

AlanFFM

Hello, Im new to the whole arduino thing and to be honest im really excited about it :)

I have a school project Im working on that requires automation. I borrowed this text from

http://www.instructables.com/id/Environmental-Mushroom-Control-Arduino-Powered/?ALLSTEPS

and I tried to upload it to my arduino. I keep getting errors and after doing some research Im still finding myself stuck in a loop. From what I understand the LCD4bit library is outdated and useless, (this is the library used) but when i replace the library with LiquidCrystall I get a whole new batch of problems. Can anyone help me out?

Im very excited about growing mushrooms and plants :)

Thanks!

I forgot the text! Woops:

http://www.instructables.com/files/orig/FMK/3BR4/GAPURHM2/FMK3BR4GAPURHM2.tmp

AWOL

Quote
I keep getting errors

Which are..?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

AlanFFM

#2
Oct 12, 2012, 03:21 am Last Edit: Oct 12, 2012, 03:27 am by AlanFFM Reason: 1
...Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:29:57: error: WConstants.h: No such file or directory
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp: In member function 'void LCD4Bit::pulseEnablePin()':
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:58: error: 'LOW' was not declared in this scope
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:58: error: 'digitalWrite' was not declared in this scope
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:59: error: 'delayMicroseconds' was not declared in this scope
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:61: error: 'HIGH' was not declared in this scope
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:64: error: 'delay' was not declared in this scope
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp: In member function 'void LCD4Bit::pushNibble(int)':
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:73: error: 'digitalWrite' was not declared in this scope
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp: In member function 'void LCD4Bit::commandWriteNibble(int)':
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:99: error: 'LOW' was not declared in this scope
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:99: error: 'digitalWrite' was not declared in this scope
...Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp: In member function 'void LCD4Bit::commandWrite(int)':
...Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:106: error: 'LOW' was not declared in this scope
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:106: error: 'digitalWrite' was not declared in this scope
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp: In member function 'void LCD4Bit::print(int)':
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:118: error: 'HIGH' was not declared in this scope
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:118: error: 'digitalWrite' was not declared in this scope
...Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:119: error: 'LOW' was not declared in this scope
...Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp: In member function 'void LCD4Bit::clear()':
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:139: error: 'delay' was not declared in this scope
...Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp: In member function 'void LCD4Bit::init()':
...\Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:146: error: 'OUTPUT' was not declared in this scope
...Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:146: error: 'pinMode' was not declared in this scope
...Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:154: error: 'delay' was not declared in this scope
...Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:160: error: 'delayMicroseconds' was not declared in this scope
...Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp: In member function 'void LCD4Bit::leftScroll(int, int)':
...Desktop\arduino-1.0.1\libraries\LCD4Bit\LCD4Bit.cpp:225: error: 'delay' was not declared in this scope


Thats when i use LCD4bit library



sketch_oct11c:151: error: 'LCD4Bit' was not declared in this scope
sketch_oct11c.cpp: In function 'void setup()':
sketch_oct11c:201: error: no matching function for call to 'LiquidCrystal::init()'
C:\Users\...\Desktop\arduino-1.0.1\libraries\LiquidCrystal/LiquidCrystal.h:60: note: candidates are: void LiquidCrystal::init(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)
sketch_oct11c.cpp: In function 'void loop()':
sketch_oct11c:278: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:279: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:284: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:286: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:288: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:290: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:292: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:293: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:294: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:296: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:298: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:299: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:300: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:302: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:381: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:384: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:388: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:391: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:394: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:398: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:401: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:404: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:407: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:410: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:413: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:416: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:459: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:466: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:471: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:476: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:481: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:489: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:496: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:501: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:506: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:511: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:521: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:528: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:533: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:538: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:543: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:550: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:551: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:553: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:554: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:556: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:557: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:577: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:581: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:583: error: 'class LiquidCrystal' has no member named 'cursorTo'
sketch_oct11c:588: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:592: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:596: error: 'class LiquidCrystal' has no member named 'printIn'
sketch_oct11c:600: error: 'class LiquidCrystal' has no member named 'printIn'

when i use liquid crystall

AWOL

#3
Oct 12, 2012, 03:33 am Last Edit: Oct 12, 2012, 03:39 am by AWOL Reason: 1
Code: [Select]
LCD4Bit lcd = LCD4Bit(2); // use both lines
Quote
sketch_oct11c:151: error: 'LCD4Bit' was not declared in this scope

I'm guessing ( because I can't see your code) that you left that line in.

This Is well worth a read
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

AlanFFM

So basically I have to delete any LCD4bit keywords? Im still lost =/

AWOL

And lost you will probably remain until you post your code.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

AlanFFM

#6
Oct 12, 2012, 03:52 pm Last Edit: Oct 12, 2012, 03:56 pm by AWOL Reason: 1
I'm not sure if this is waht you mean by code, but this is what i try to upload to the arduino.

I tried switching out LCD4bit with liquid crystall and got the errors above i posted in the last post.

Code: [Select]
#include <LCD4Bit.h>
#include <stdlib.h> // for itoa() call
#include <EEPROM.h>



/* Humidity Calibration
Hum     Time between pulses
75%            788.4
100.00% 840
y = mx +c ,
Where y = Time to between up pulses, x = humidity value
*/
#define HUMIDITY_C  680 //668  
#define HUMIDITY_M 1.6 //1.72

/* Temperature/Thermistor Calibration
5v--100k_Therm--input--100k --gnd
y = bit value from input, x = Temperature Value
y = mx +c    */
#define TEMPERATURE_M 13.31
#define TEMPERATURE_C 188.1

/* Carbon dioxide calibration
y = MLogn(x) + C
x = e^((y-C)/M)

where y is bit value and x is c02 concentration
C02 Bit Value
400 279.98

10000 -0.03
 =-87*(LN(N25))+800
*/
#define Carbon_M -83.45 // was-87
#define Carbon_C 768.62 //was 800

/***********************/
/* Interval Definitions*/
#define INTERVAL 30000 //Define ms INTERVAL in between trigerring
#define SENSOR_INTERVAL 400 // SENSOR INTERVAL
#define BACKLIGHT_TIME 180000 // 1 minute for backlight on after no keypress. NOT BEING USED NOW
#define EE_PROM_INTERVAL 600000 //write data to eeprom every 10minutes

/*******/
/*Define array size to be used for averaging. */
/*In The array, the max value and min value are taken out and the rest averaged*/
/* If 2 or less, it is just averaged*/
#define ARRAY_SIZE 30



/**********************/
/*Hysterisis Intervals*/
#define TEMP_LO 1
#define TEMP_HI 2
#define HUM_LO 5
#define HUM_HI 0 //trimmed as tends to overshoot
#define CO2_LO 200
#define CO2_HI 100

/**********************/
/* Define input Pins  */
//Analog
#define THERM1  1    // Analog 1 Thermistor 1   voltage
#define THERM2 2    // Analog 2   Thermistor 2 Voltage
#define CARBONDI3 3 // Analog 3
// Digital
#define HUMIDITY2 2 // Digital 2 Humidity  

/**********************/
/*Define output  Pins */
//Digital
#define LEDPIN  13     // select the pin for the LED
#define RELAY1  3      // Relay to start the first heater
#define RELAY2  11      // Relay to start the second heater
#define RELAY3  12     //Relay to start the humidifier
#define RELAY4  13     //Relay to start air pump
#define BACKLIGHT 10   //backlight Pin Value
//Can use pins 0 + 1 if serial not being used.. or use an analog pin.

/******Define Size of storage array for values*/
#define ARRAY_STORE 200 //how many lines to store in eeprom. ARRAY_STORE*4 <1k



/*****************************/
/*set Triggers *************/
int heatTrigger1  = 25;
int heatTrigger2  = 20;
int HumTrigger = 80;  
int C02Trigger = 800;

/***************************/
/* Sensor Value initialize */
int thermValue1 = 0;  
int thermValue2 = 0;
int humValue = 0;
int carbonDiVal = 0;

int therm1[ARRAY_SIZE];
int therm2[ARRAY_SIZE];
int humval[ARRAY_SIZE];
int carbonD[ARRAY_SIZE];



/************************/
/*Set time check ms     */
long last_check = millis();
long sensor_check = millis();
long backlight = millis();
int timing = millis();
long time_eeprom = millis();

/**************************/
/** LCD Shield            */
LCD4Bit lcd = LCD4Bit(2); // use both lines
char buf[5]; //used in conversion of int to char for lcd

int configure = 0; //use select as an on/off for configuring
int showReading = 0; //select which value to modify  0-3
int adc_key_in = 1024; //Start with -1 key value

int adc_key_val[5] = {
 100, 160, 360, 770, 800 }; //Analog values from Keys on keypad shield

/*
int adc_key_val[5] = {
65, 218, 393, 601,1000};
*/
int NUM_KEYS = 5;
int key= -1;

char trigger_names[4][15] = {  
 "Temp Trigger 1",
 "Temp Trigger 2",
 "Humid Trigger",
 "C02 Trigger" };

/* Set up index value for storing values in eeprom*/
int k=0;



void setup()
{
 // declare pins as output
 //pinMode(LEDPIN, OUTPUT);  
 pinMode(RELAY1, OUTPUT);
 pinMode(RELAY2, OUTPUT);
 pinMode(RELAY3, OUTPUT);
 pinMode(RELAY4, OUTPUT);

 //Setup averaging arrays
 int i;


 for(i=0; i< ARRAY_SIZE; i++)
 {
   therm1[i] = 512;
   therm2[i] = 512;
   humval[i] = 735;
   carbonD[i] = 645;
 }
 //pinMode(BACKLIGHT,OUTPUT); Backlight on all the time, so comment out this.

 lcd.init();
 lcd.clear();
 digitalWrite(BACKLIGHT,HIGH);
 //Start serial comms with computer
 Serial.begin(115200);



}

void loop() {


 key = get_key(adc_key_in); //In case

 //reset sensor_check if millis() has overflowed
 if( millis() < sensor_check ){ sensor_check = millis();  }

/* This is for backlight off delay.
 if ( (millis() < backlight) || millis() > (backlight + BACKLIGHT_TIME))
 { digitalWrite(BACKLIGHT,LOW); }
*/


 /*Read sensor only after delay of sensor_check*/
 if(millis() - sensor_check > SENSOR_INTERVAL )
 {
   sensor_check = millis();

   int i;

   for (i=0; i < ARRAY_SIZE -1 ; i++) {  
     therm1[i] = therm1[i+1];
     therm2[i] = therm2[i+1];
     humval[i] = humval[i+1];
     carbonD[i] = carbonD[i+1];
   }



   /*** Read in sensor values and change to fit actual temp/hum/ppm values*/
   therm1[ARRAY_SIZE -1] = analogRead(THERM1);    
   int temp1 = mov_avg(therm1);
   thermValue1 = (temp1 - TEMPERATURE_C)/TEMPERATURE_M; // x = (y-c)/m

   therm2[ARRAY_SIZE -1] = analogRead(THERM2);      //thermValue2 = analogRead(THERM2);
   int temp2 = mov_avg(therm2);
   thermValue2 = (temp2- TEMPERATURE_C) /TEMPERATURE_M;

   int hum_temp = pulseIn(HUMIDITY2,HIGH,2000); //
   if (hum_temp > 40 )  //Remove some non readings which give huge negative numbers
   {
     humval[ARRAY_SIZE -1] = hum_temp;
     hum_temp = mov_avg(humval);
     humValue = (hum_temp - HUMIDITY_C)/HUMIDITY_M; // y -c/M = x
   }

   int c_temp = analogRead(CARBONDI3);
   Serial.print(c_temp);
  /*if (( c_temp > 0 ) && (c_temp <300))      //stops unecessary calcs which grind arduino to a halt
   {*/
     carbonD[ARRAY_SIZE -1] = c_temp;
     c_temp = mov_avg(carbonD);
     Serial.print(":");
     Serial.print(c_temp);
     float c_float = c_temp - Carbon_C; // For ease of use in power function
     c_float = c_float/Carbon_M;
     Serial.print(":");
     Serial.print(c_float);
     carbonDiVal  = pow(2.718,c_float);
   //}
   Serial.print(":");
   Serial.println(carbonDiVal);



/***************************/



........ ran out of pasting room.

the whole thing is here: http://www.instructables.com/files/orig/FMK/3BR4/GAPURHM2/FMK3BR4GAPURHM2.tmp

Moderator edit: I forgot to say (I assumed you'd read the post about how to post) "...and don't forget to use code tags.

AWOL

#7
Oct 12, 2012, 03:56 pm Last Edit: Oct 12, 2012, 03:58 pm by AWOL Reason: 1
Code: [Select]
#include <LCD4Bit.h>
Code: [Select]
LCD4Bit lcd = LCD4Bit(2); // use both line
I thought we'd already established that you weren't using that?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

AlanFFM

Sorry im still new ><

I replaced LCD4bit so now it looks like this.. .

Code: [Select]

#include <LiquidCrystal.h>


#include <stdlib.h> // for itoa() call
#include <EEPROM.h>


/* Humidity Calibration
Hum     Time between pulses
75%            788.4
100.00% 840
y = mx +c ,
Where y = Time to between up pulses, x = humidity value
*/
#define HUMIDITY_C  680 //668  
#define HUMIDITY_M 1.6 //1.72

/* Temperature/Thermistor Calibration
5v--100k_Therm--input--100k --gnd
y = bit value from input, x = Temperature Value
y = mx +c    */
#define TEMPERATURE_M 13.31
#define TEMPERATURE_C 188.1

/* Carbon dioxide calibration
y = MLogn(x) + C
x = e^((y-C)/M)

where y is bit value and x is c02 concentration
C02 Bit Value
400 279.98

10000 -0.03
 =-87*(LN(N25))+800
*/
#define Carbon_M -83.45 // was-87
#define Carbon_C 768.62 //was 800

/***********************/
/* Interval Definitions*/
#define INTERVAL 30000 //Define ms INTERVAL in between trigerring
#define SENSOR_INTERVAL 400 // SENSOR INTERVAL
#define BACKLIGHT_TIME 180000 // 1 minute for backlight on after no keypress. NOT BEING USED NOW
#define EE_PROM_INTERVAL 600000 //write data to eeprom every 10minutes

/*******/
/*Define array size to be used for averaging. */
/*In The array, the max value and min value are taken out and the rest averaged*/
/* If 2 or less, it is just averaged*/
#define ARRAY_SIZE 30



/**********************/
/*Hysterisis Intervals*/
#define TEMP_LO 1
#define TEMP_HI 2
#define HUM_LO 5
#define HUM_HI 0 //trimmed as tends to overshoot
#define CO2_LO 200
#define CO2_HI 100

/**********************/
/* Define input Pins  */
//Analog
#define THERM1  1    // Analog 1 Thermistor 1   voltage
#define THERM2 2    // Analog 2   Thermistor 2 Voltage
#define CARBONDI3 3 // Analog 3
// Digital
#define HUMIDITY2 2 // Digital 2 Humidity  

/**********************/
/*Define output  Pins */
//Digital
#define LEDPIN  13     // select the pin for the LED
#define RELAY1  3      // Relay to start the first heater
#define RELAY2  11      // Relay to start the second heater
#define RELAY3  12     //Relay to start the humidifier
#define RELAY4  13     //Relay to start air pump
#define BACKLIGHT 10   //backlight Pin Value
//Can use pins 0 + 1 if serial not being used.. or use an analog pin.

/******Define Size of storage array for values*/
#define ARRAY_STORE 200 //how many lines to store in eeprom. ARRAY_STORE*4 <1k



/*****************************/
/*set Triggers *************/
int heatTrigger1  = 25;
int heatTrigger2  = 20;
int HumTrigger = 80;  
int C02Trigger = 800;

/***************************/
/* Sensor Value initialize */
int thermValue1 = 0;  
int thermValue2 = 0;
int humValue = 0;
int carbonDiVal = 0;

int therm1[ARRAY_SIZE];
int therm2[ARRAY_SIZE];
int humval[ARRAY_SIZE];
int carbonD[ARRAY_SIZE];



/************************/
/*Set time check ms     */
long last_check = millis();
long sensor_check = millis();
long backlight = millis();
int timing = millis();
long time_eeprom = millis();

/**************************/
/** LCD Shield            */
LiquidCrystal lcd = LiquidCrystal(2); // use both lines
char buf[5]; //used in conversion of int to char for lcd

int configure = 0; //use select as an on/off for configuring
int showReading = 0; //select which value to modify  0-3
int adc_key_in = 1024; //Start with -1 key value

int adc_key_val[5] = {
 100, 160, 360, 770, 800 }; //Analog values from Keys on keypad shield

/*
int adc_key_val[5] = {
65, 218, 393, 601,1000};
*/
int NUM_KEYS = 5;
int key= -1;

char trigger_names[4][15] = {  
 "Temp Trigger 1",
 "Temp Trigger 2",
 "Humid Trigger",
 "C02 Trigger" };

/* Set up index value for storing values in eeprom*/
int k=0;



void setup()
{
 // declare pins as output
 //pinMode(LEDPIN, OUTPUT);  
 pinMode(RELAY1, OUTPUT);
 pinMode(RELAY2, OUTPUT);
 pinMode(RELAY3, OUTPUT);
 pinMode(RELAY4, OUTPUT);

 //Setup averaging arrays
 int i;


 for(i=0; i< ARRAY_SIZE; i++)
 {
   therm1[i] = 512;
   therm2[i] = 512;
   humval[i] = 735;
   carbonD[i] = 645;
 }
 //pinMode(BACKLIGHT,OUTPUT); Backlight on all the time, so comment out this.

 lcd.init();
 lcd.clear();
 digitalWrite(BACKLIGHT,HIGH);
 //Start serial comms with computer
 Serial.begin(115200);



}

void loop() {


 key = get_key(adc_key_in); //In case

 //reset sensor_check if millis() has overflowed
 if( millis() < sensor_check ){ sensor_check = millis();  }

/* This is for backlight off delay.
 if ( (millis() < backlight) || millis() > (backlight + BACKLIGHT_TIME))
 { digitalWrite(BACKLIGHT,LOW); }
*/


 /*Read sensor only after delay of sensor_check*/
 if(millis() - sensor_check > SENSOR_INTERVAL )
 {
   sensor_check = millis();

   int i;

   for (i=0; i < ARRAY_SIZE -1 ; i++) {  
     therm1[i] = therm1[i+1];
     therm2[i] = therm2[i+1];
     humval[i] = humval[i+1];
     carbonD[i] = carbonD[i+1];
   }



   /*** Read in sensor values and change to fit actual temp/hum/ppm values*/
   therm1[ARRAY_SIZE -1] = analogRead(THERM1);    
   int temp1 = mov_avg(therm1);
   thermValue1 = (temp1 - TEMPERATURE_C)/TEMPERATURE_M; // x = (y-c)/m

   therm2[ARRAY_SIZE -1] = analogRead(THERM2);      //thermValue2 = analogRead(THERM2);
   int temp2 = mov_avg(therm2);
   thermValue2 = (temp2- TEMPERATURE_C) /TEMPERATURE_M;

   int hum_temp = pulseIn(HUMIDITY2,HIGH,2000); //
   if (hum_temp > 40 )  //Remove some non readings which give huge negative numbers
   {
     humval[ARRAY_SIZE -1] = hum_temp;
     hum_temp = mov_avg(humval);
     humValue = (hum_temp - HUMIDITY_C)/HUMIDITY_M; // y -c/M = x
   }

   int c_temp = analogRead(CARBONDI3);
   Serial.print(c_temp);
  /*if (( c_temp > 0 ) && (c_temp <300))      //stops unecessary calcs which grind arduino to a halt
   {*/
     carbonD[ARRAY_SIZE -1] = c_temp;
     c_temp = mov_avg(carbonD);
     Serial.print(":");
     Serial.print(c_temp);
     float c_float = c_temp - Carbon_C; // For ease of use in power function
     c_float = c_float/Carbon_M;
     Serial.print(":");
     Serial.print(c_float);
     carbonDiVal  = pow(2.718,c_float);
   //}
   Serial.print(":");
   Serial.println(carbonDiVal);

   /**Add first line of Display**/
   if (configure == 0)
   {
     lcd.cursorTo(1,0);
     lcd.printIn("T1 T2 Hu CO2");  
   }
   /**** Add second line of the Display *****/
   if (configure == 0)
   {
     lcd.cursorTo(2,0);
     itoa(thermValue1, buf, 10);
     lcd.printIn(buf);

     lcd.cursorTo(2,3);
     itoa(thermValue2, buf, 10);
     lcd.printIn(buf);

     lcd.cursorTo(2,8);
     lcd.printIn(" ");
     lcd.cursorTo(2,6);
     itoa(humValue, buf, 10);
     lcd.printIn(buf);

     lcd.cursorTo(2,12);
     lcd.printIn("  ");
     lcd.cursorTo(2,9);
     itoa(carbonDiVal, buf, 10);
     lcd.printIn(buf);
   }


   /*Print Output Values*/
   /*
Serial.print(thermValue1);
    Serial.print(":");
    Serial.print(thermValue2);
    Serial.print(":");
    Serial.print(hum_temp); //usually humValue
    Serial.print(":");
    Serial.print(carbonDiVal);
    Serial.println(":");
    */
   /* PRINT ARRAYS THAT ARE AVERAGED
    Serial.print("**Therm1*");
    Serial.print(thermValue1);
    Serial.print("*(");
    for( i=0; i<ARRAY_SIZE; i++)
    {
    Serial.print(therm1[i]);
    Serial.print(":");
    }
    Serial.print(")**Therm2*");
    Serial.print(thermValue2);
    Serial.print("*(");
    for( i=0; i<ARRAY_SIZE; i++)
    {
    Serial.print(therm2[i]);
    Serial.print(":");
    }    
    Serial.print(")**Humid*");
    Serial.print(humValue);
    Serial.print("*(");
    for( i=0; i<ARRAY_SIZE; i++)
    {
    Serial.print(humval[i]);
    Serial.print(":");      
    }
    Serial.print(")**carbonD*");
    Serial.print(carbonDiVal);
    Serial.print("*(");
    for( i=0; i<ARRAY_SIZE; i++)
    {
    Serial.print(carbonD[i]);
    Serial.print(":");      
    }
    Serial.println(")");
    */

 }

 /********************************************/
 /*EEPROM STORAGE CODE   *********************/
 if(millis() < time_eeprom) { time_eeprom = millis(); }
 /**Put values into eeprom*/
 if(millis() - time_eeprom > EE_PROM_INTERVAL)
 {
   time_eeprom = millis();
   EEPROM.write((k*4),(thermValue1));
   EEPROM.write((k*4+1),(thermValue2));
   EEPROM.write((k*4+2),(humValue));
   EEPROM.write((k*4+3),(carbonDiVal/10));
   k=k+1;
   if(k>=ARRAY_STORE) { k=0;  }
 }


again ran out of room

AWOL

Code: [Select]
LiquidCrystal lcd = LiquidCrystal(2)
But if you look here, you'll see nothing like what you have written, which is why the compiler is so upset.
How is your LCD connected?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

AlanFFM

3 wires black for ground red for the 5 volt and the Yellow for digital input i believe slot 13

AWOL

So, it's a serial LCD?
Have you got a link?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

AlanFFM

https://www.sparkfun.com/products/9395

Same one but a red board instead of green (pretty sure that dosent change anything)

AWOL

#13
Oct 12, 2012, 04:25 pm Last Edit: Oct 12, 2012, 04:27 pm by AWOL Reason: 1
So this thread has been something of a wild goose chase?
Did you read this?
Also this
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

AlanFFM

Really lost  :(
I guess theres no way to "plug and play" ... I dont really know much about programming so this is gonna suck lol.
So I guess i need to get their library first. Once i get that I'm going to have to rewrite all the LCD coding. Please tell me im wrong =/

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy