Pages: 1 2 [3]   Go Down
Author Topic: I Keep getting errors when I try to upload  (Read 2859 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Part 3
Code:
/***** Up Key Press ******/
  if ( (key == 1) && ( configure == 1 ) )
  {
    lcd.cursorTo(2,0);

    switch(showReading)
    {
    case 0: //heatTrigger1
      heatTrigger1 = heatTrigger1 +1;
      itoa(heatTrigger1, buf, 10);
      lcd.println(buf);
      break;
    case 1: //heatTrigger2
      heatTrigger2 = heatTrigger2 +1;
      itoa(heatTrigger2, buf, 10);
      lcd.println(buf);
      break;
    case 2:
      HumTrigger = HumTrigger +5;
      itoa(HumTrigger, buf, 10);
      lcd.println(buf);
      break;
    case 3:
      C02Trigger = C02Trigger + 100;
      itoa(C02Trigger, buf, 10);
      lcd.println(buf);
      break;
    }
  }

  /**** Keypress down ****/
  if ( (key == 2) && ( configure == 1 ))
  {
    lcd.cursorTo(2,0);

    switch(showReading)
    {
    case 0: //heatTrigger1
      heatTrigger1 = heatTrigger1 -1;
      itoa(heatTrigger1, buf, 10);
      lcd.println(buf);
      break;
    case 1: //heatTrigger2
      heatTrigger2 = heatTrigger2 -1;
      itoa(heatTrigger2, buf, 10);
      lcd.println(buf);
      break;
    case 2:
      HumTrigger = HumTrigger -5;
      itoa(HumTrigger, buf, 10);
      lcd.println(buf);
      break;
    case 3:
      C02Trigger = C02Trigger - 100;
      itoa(C02Trigger, buf, 10);
      lcd.println(buf);
      break;
    }

  }

  /***** Keypress Right ****/

  if ( (key == 0) && (configure ==1) )
  {
    lcd.cursorTo(2,0); //line 2 x =0

      switch(showReading)
    {
    case 0: //heatTrigger1 to c02
      showReading = 1;
      itoa(heatTrigger2, buf, 10);
      lcd.println(buf);
      break;
    case 1: //heatTrigger2 to HumTrigger
      showReading = 2;
      itoa(HumTrigger, buf, 10);
      lcd.println(buf);
      break;
    case 2: //HumTrigger to C02Trigger
      showReading = 3;
      itoa(C02Trigger, buf, 10);
      lcd.println(buf);
      break;
    case 3: // C02Trigger to heatTrigger1
      showReading = 0;
      itoa(heatTrigger1, buf, 10);
      lcd.println(buf);
      break;
    }
  }
  /******Dump to serial all EEPROM values if keypress right no config***/
  if ( (key == 0) && (configure ==0) )
  {
    lcd.cursorTo(1,0);
    lcd.println("Upload");
    char buf2[10];
    lcd.cursorTo(2,0);
    lcd.println("               ");

    lcd.cursorTo(2,10);
    lcd.cursorTo(2,0);


    Serial.println("");
    Serial.print("Values end at:");
    Serial.println(k+1);
    for( k=0; k <=ARRAY_STORE; k++) //l=l+4
    {
      Serial.print(int(EEPROM.read(k*4)));
      Serial.print(",");
      Serial.print(int(EEPROM.read(k*4+1)));
      Serial.print(",");
      Serial.print(int(EEPROM.read(k*4+2)));
      Serial.print(",");
      Serial.println(int(EEPROM.read(k*4+3)));
    }
  }


  /***** Add the first line of the display******/
  lcd.cursorTo(1,0); //line 1 x =0

    if (configure == 1)
  {
    lcd.println(trigger_names[showReading]);

    lcd.cursorTo(2,0);
    switch(showReading)
    {
    case 0:
      itoa(heatTrigger1, buf, 10);
      lcd.println(buf);
      break;
    case 1:
      itoa(heatTrigger2, buf, 10);
      lcd.println(buf);
      break;
    case 2:
      itoa(HumTrigger, buf, 10);
      lcd.println(buf);
      break;
    case 3:
      itoa(C02Trigger, buf, 10);
      lcd.println(buf);
      break;
    }
  }

} //End Main loop

int get_key(unsigned int input)
{
  int k;

  for ( k=0; k < NUM_KEYS; k++)
  {
    if (input < adc_key_val[k] )
    {
      return k;
    }
  }

  if ( k >= NUM_KEYS)
  {
    k = -1;
  }
  return k;
}

int mov_avg(int averages[ARRAY_SIZE])
{
  int summation = averages[0];
  int i=1;
  for( i=1; i < ARRAY_SIZE; i++)
  {
    summation = averages[i] + summation;
  }
  if(ARRAY_SIZE >2)
  {
    summation = summation - max_array(averages) - min_array(averages);
    summation = summation/(ARRAY_SIZE -2);
  }
  else
  {
    summation = summation/ARRAY_SIZE;
  }
  return summation;
}


int max_array(int array[ARRAY_SIZE])
{
  int i=0;
  int current= array[0];
  for( i=1; i<ARRAY_SIZE; i++)
  {
    if (array[i] > current)
    {
      current = array[i];
    }
  }
  return current;
}

int min_array(int array[ARRAY_SIZE])
{
  int i=0;
  int current= array[0];
  for( i=1; i<ARRAY_SIZE; i++)
  {
    if (array[i] < current)
    {
      current = array[i];
    }
  }
  return current;
}

and here are the list of errors

Mushroom_Arduino.cpp: In function 'void setup()':
Mushroom_Arduino:202: error: 'class serLCD' has no member named 'init'
Mushroom_Arduino.cpp: In function 'void loop()':
Mushroom_Arduino:279: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:285: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:289: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:293: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:295: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:299: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:301: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:382: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:392: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:402: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:411: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:460: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:490: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:522: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:551: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:554: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:557: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:558: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:578: error: 'class serLCD' has no member named 'cursorTo'
Mushroom_Arduino:584: error: 'class serLCD' has no member named 'cursorTo'
Logged

Saskatchewan
Offline Offline
Sr. Member
****
Karma: 15
Posts: 348
When the going gets weird, the weird turn pro. - Hunter S. Thompson
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I see you are using a different library than I'm familiar with. A quick google turned up the .h file though.

http://www.kwantlen.ca/science/physics/faculty/mcoombes/APSC/Homework/Ass1%20-%20code/serLCD.h

Code:
//****************************************************************************************
//
// serLCD.h
//
// Simplifies the use of the SparkFUN LCD
//
// Mike Coombes, 25 May 2007
//
//****************************************************************************************

#include <usart.h>       // library containing serial communtication functions

void LCD_ClearDisplay(void);
void LCD_CursorOn(void);
void LCD_CursorOff(void);
void LCD_MoveRight(void);
void LCD_MoveLeft(void);
void LCD_ScrollRight(void);
void LCD_ScrollLeft(void);
void LCD_BlinkOn(void);
void LCD_BlinkOff(void);
void LCD_DisplayOn(void);
void LCD_DisplayOff(void);
void LCD_UnderlineOn(void);
void LCD_UnderlineOff(void);
void LCD_Position(unsigned char line, unsigned char column);

I don't see a cursorTo function in there which is why the error occurs. I do see an LCD_Position function that takes line and column. That list there is actually the function prototypes for the library.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ah i see! thanks smiley-grin

so i need to replace cursorTo with LCDPosition?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

just out of curiosity what library are you using? i might be able to just swap librarries ^^

edit: also getting a "no member called init" error. serLCD library sucks basically?
« Last Edit: October 16, 2012, 05:05:20 pm by AlanFFM » Logged

Saskatchewan
Offline Offline
Sr. Member
****
Karma: 15
Posts: 348
When the going gets weird, the weird turn pro. - Hunter S. Thompson
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
lcd.LCD_Position(y, x); // where y is row and x is column


It would have to be exactly as it is in that file.

If that doesn't work I'm hopelessly wrong.

I got my stuff from Seeed and used this as a guide. It's the serialLCD library and can be downloaded near the bottom in resources. The page also has a good description of the available functions. It should work.

http://www.seeedstudio.com/wiki/Grove_-_Serial_LCD_v1.0b
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

LCD_ didnt work , did some googling and found setCursor. seems to wrk. however im getting an
sketch_oct16b:202: error: 'class serLCD' has no member named 'init'
error.
Im not sure what this means.
Logged

Saskatchewan
Offline Offline
Sr. Member
****
Karma: 15
Posts: 348
When the going gets weird, the weird turn pro. - Hunter S. Thompson
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It means that the serLCD class doesn't have a member function called init. The only member functions it has would be the ones in that serLCD.h file I posted.

setCursor is a member of the SerialLCD library I linked to and what I was using.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm so close!!! It works for 1 second! the information, data and setup all flashes on screen for about 1-2 seconds. After that the screen goes blank.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 46113
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm so close!!! It works for 1 second! the information, data and setup all flashes on screen for about 1-2 seconds. After that the screen goes blank.
I'd guess, then, that you either not powering the device correctly, or that you are running out of memory.

Code:
#define ARRAY_STORE 200 //how many lines to store in eeprom. ARRAY_STORE*4 <1k
int therm1[ARRAY_SIZE];
int therm2[ARRAY_SIZE];
int humval[ARRAY_SIZE];
int carbonD[ARRAY_SIZE];
What Arduino are you using? A 328 based Arduino does not have room to store 800 ints in EEPROM, and can barely fit that many in EEPROM. With that much SRAM used, don't expect to be able to do much else.

Edit: The <1k note assumes bytes, not ints. An int is two bytes, so the total number of ints you can store in EEPROM is 500, not the 800 here.
« Last Edit: October 17, 2012, 05:06:21 am by PaulS » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Im using an arduino uno.
I replaced the value with 125. still same problem.
After the screen goes blank the words "Temp Trigger 1" very lightly (can barely see unless you focus) flash on screen.
« Last Edit: October 17, 2012, 12:14:02 pm by AlanFFM » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 46113
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I replaced the value with 125. still same problem.
So, try a much smaller value, at least temporarily. If you set it to 25, and things work, increase from there. If not, you may have a hardware problem, or the problem is elsewhere in your code.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

same problem with 25. Im pretty sure its a coding problem. I keep getting "Temp Trigger 1" flash o nthe screen so im gonna assume theres an error in this part of the code.

Code:
/** LCD Shield            */
serLCD lcd(13); // 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;
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 46113
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I keep getting "Temp Trigger 1" flash o nthe screen so im gonna assume theres an error in this part of the code.
The only thing in that part of the code that jumps out is the useless comments.

Post (again) all of your code. As an attachment (click Additional Options... - it is selectable), if it won't fit all in one post.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thats the code with all my edits. the original code can be found here:

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

or more specifically:

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

* Mushroom.ino (16.14 KB - downloaded 9 times.)
Logged

Pages: 1 2 [3]   Go Up
Jump to: