| Arduino Forum ::  Members :: SteveHi
 Show Posts Pages: [1] 2 3
 1 Using Arduino / Programming Questions / Re: Initializing Array - expected primary expression before "{" token on: November 24, 2013, 03:14:25 pm @ mrburnetteWet Fish.....engaged.@ PaulSThis is what you were laking about, right?Code:[sunMatrix[1][0][Sunrise_Hr] = 0;sunMatrix[1][0][Sunrise_Min] = 0;sunMatrix[1][0][Sunset_Hr] = RiseHour;sunMatrix[1][0][Sunset_Min] = RiseMin + 2;sunMatrix[1][0][SunLevel] = 0;sunMatrix[1][1][Sunrise_Hr] = RiseHour;sunMatrix[1][1][Sunrise_Min] = RiseMin + 10;sunMatrix[1][1][Sunset_Hr] = RiseHour + 12;sunMatrix[1][1][Sunset_Min] = RiseMin + 7;sunMatrix[1][1][SunLevel] = RBlue_max;sunMatrix[1][2][Sunrise_Hr] = RiseHour + 12;sunMatrix[1][2][Sunrise_Min] = RiseMin + 12;sunMatrix[1][2][Sunset_Hr] = 24;sunMatrix[1][2][Sunset_Min] = 0; sunMatrix[1][2][SunLevel] = 0sunMatrix[0][0][Sunrise_Hr] = 0;sunMatrix[0][0][Sunrise_Min] = 0;sunMatrix[0][0][Sunset_Hr] = RiseHour;sunMatrix[0][0][Sunset_Min] = RiseMin + 2;sunMatrix[0][0][SunLevel] = 0;sunMatrix[0][1][Sunrise_Hr] = RiseHour;sunMatrix[0][1][Sunrise_Min] = RiseMin + 10;sunMatrix[0][1][Sunset_Hr] = RiseHour + 12;sunMatrix[0][1][Sunset_Min] = RiseMin + 7;sunMatrix[0][1][SunLevel] = RBlue_max;sunMatrix[0][2][Sunrise_Hr] = RiseHour + 12;sunMatrix[0][2][Sunrise_Min] = RiseMin + 12;sunMatrix[0][2][Sunset_Hr] = 24;sunMatrix[0][2][Sunset_Min] = 0; sunMatrix[0][2][SunLevel] = 0;it will be tedious....but effective
 2 Using Arduino / Programming Questions / Re: Initializing Array - expected primary expression before "{" token on: November 24, 2013, 10:15:56 am I see....somewhat.Since,sunMatrix[CHANNELS][MAXPERIODS][5]={ {Gives me the same compilation errorDo I have to initialise like this?int sunMatrix[CHANNELS][MAXPERIODS][5]={ {Or, If you could please point me to a reference where I can learn the correct way to initialize this array. The Reference center here did not offer much help for what I'm trying to do.Thanks AWOL!
 3 Using Arduino / Programming Questions / Re: Initializing Array - expected primary expression before "{" token on: November 24, 2013, 09:43:34 am Thanks for the quick reply AWOL.We're getting to where I'm going wrong. I am guessing I do not know how to declare it as I thought that that's what I was doing with this line.int sunMatrix[CHANNELS][MAXPERIODS][5];
 4 Using Arduino / Programming Questions / Initializing Array - expected primary expression before "{" token on: November 24, 2013, 09:20:43 am Hello everyone,I would like to initialize an array from a void function, and I am having a bit of difficultly achieving that.Here is the code as I have it:Code:int RiseHour = 0;int RiseMin = 0;int change_start_time = 0;const int CHANNELS = 8;const int MAXPERIODS = 3;const int Sunrise_Hr = 0;const int Sunrise_Min = 1;const int Sunset_Hr = 2;const int Sunset_Min = 3;const int SunLevel = 4;int sunMatrix[CHANNELS][MAXPERIODS][5];int sunValue[CHANNELS] = {0, 0, 0, 0, 0, 0, 0, 0};void UpdateMatrix(){sunMatrix ={ { {0, 0, RiseHour+2, RiseMin, 0}, {RiseHour+2, RiseMin+14, RiseHour+8, RiseMin, White_max},               ////Wht_Ch1 {RiseHour+8, RiseMin+12, 24, 0, 0} },{ {0, 0, RiseHour, RiseMin+2, 0}, {RiseHour, RiseMin+10, RiseHour+12, RiseMin+7, RBlue_max},             ////RBlue_Ch1 {RiseHour+12, RiseMin+12, 24, 0, 0} },{ {0, 0, RiseHour, RiseMin+8, 0}, {RiseHour, RiseMin+14, RiseHour+12, RiseMin+2, Blue_max},               ////Blue_Ch1 {RiseHour+12, RiseMin+8, 24, 0, 0} },{  {0, 0, RiseHour+2, RiseMin+2, 0}, {RiseHour+2, RiseMin+14, RiseHour+8, RiseMin+2, White_max},             ////Wht_Ch2 {RiseHour+8, RiseHour+13, 24, 0, 0} },{ {0, 0, RiseHour+2, RiseMin+3, 0}, {RiseHour+2, RiseMin+14, RiseHour+8, 20, White_max},             ////Wht_Ch3 {RiseHour+8, RiseMin+14, 24, 0, 0} },{ {0, 0, RiseHour, RiseMin+3, 0}, {RiseHour, RiseMin+10, RiseHour+12, RiseMin+9, RBlue_max},              ////RBlue_Ch2 {RiseHour+12, RiseMin+13, 24, 0, 0} },{ {0, 0, RiseHour, RiseMin+10, 0}, {RiseHour, RiseMin+14, RiseHour+12, RiseMin+5, Blue_max},               ////Blue_Ch2 {RiseHour+12, RiseMin+9, 24, 0, 0} },{ {0, 0, RiseHour, RiseMin, 2}, {RiseHour, RiseMin+3, RiseHour+12, RiseMin+13, UV_max},              ////UV_Ch1 {RiseHour+12, RiseMin+14, 24, 0, 2} }}I am receiving a -expected a primary expression before "{" token- error during compilation on this linesunMatrix ={I am hoping one of you great minds can direct me as to where I might be going wrong??Thanks for your time!
 5 Using Arduino / General Electronics / external power on an Atlas Scientific pH stamp on: October 26, 2013, 01:49:29 am Hello all,I would like to use an external 5v source to power the pictured pH stamp from Atlas Scientific.Can I do that? or, is it necessary to run the 5v and GND from the Arduino?https://www.atlas-scientific.com/_images/_gallery/embedded/26-ph-3-circuit.jpgThanks for any help!
 6 Using Arduino / Programming Questions / Re: Learning Arrays Question on: September 22, 2013, 12:20:09 pm Quote from: PaulS on September 22, 2013, 11:42:14 amQuotesomething like:outletState = digitalRead(OUTLETS[on]);If you call that in a loop, outletState will contain the state of the last pin in the array. You need an array of states, too.Code:outletState[on] = digitalRead(OUTLETS[on]);Thank you both so much! It's starting to sink in.I've been making some progress, and have it producing the results I would like. However, the code is not that efficient. Before you clued me in on needing an outletState array as well I wrote a digitalRead of every index = to outletStateExample:outletState = digitalRead(OUTLETS[0]);if (outletState == HIGH){....else if (outletState == LOW){....and then to the next if & else ifoutletState = digitalRead(OUTLETS[1]);and so on through the index.Now I can try slimming it down a bit.Thanks to you both!!
 7 Using Arduino / Programming Questions / Re: Learning Arrays Question on: September 22, 2013, 11:26:03 am Quote from: AWOL on September 22, 2013, 11:13:19 amOUTLETS has the value A0.That is never ever going to be equal to one.QuoteI guess I don't understand how it is discarding the result.OK, put it this way - where do you think the value returned by the digitalRead is going to end up?I think I'm starting to see. I need to store or direct the read?something like:outletState = digitalRead(OUTLETS[on]);where outletState is where the digitalRead ends up?
 8 Using Arduino / Programming Questions / Re: Learning Arrays Question on: September 22, 2013, 11:07:11 am Quote from: AWOL on September 22, 2013, 11:00:10 amCode:if (OUTLETS[0] == HIGH){Does it seem likely that A0 has the same value as HIGH (1)?I couldn't be sure without completely guessing. When you say HIGH(1) are you referring to HIGH(1) and LOW would then be LOW(0)?
 9 Using Arduino / Programming Questions / Re: Learning Arrays Question on: September 22, 2013, 11:01:47 am Read the pin and discard the result.Not good.Ah. Ok. I guess I don't understand how it is discarding the result.Should I remove that for loop, and digitalRead each?I was trying to be efficient
 10 Using Arduino / Programming Questions / Re: Learning Arrays Question on: September 22, 2013, 10:57:48 am I have changed it back to 8. I started to confuse myself when I was trying to manipulate the code to get the desired result.Besides that error the arrays seem proper??Perhaps I should be looking in my status function with a problem in the if & else if statements.
 11 Using Arduino / Programming Questions / Re: Learning Arrays Question on: September 22, 2013, 10:40:42 am No. I didn't mean to leave it off. I had originally set it to 8, however when it didn't work the first time I had changed it to 7. My thinking was that the first index was zero[0].
 12 Using Arduino / Programming Questions / Learning Arrays Question on: September 22, 2013, 10:35:34 am Hi everyone.I am trying to learn how to use and incorporate arrays into my code, but I don't think I have a 100% handle on it yet.The following is an array that I have been trying to write, but I am not getting results that I would suspect.I set up the array pin numbersin void set up I set all pins in array to OUTPUTSand use a digitalWrite to set all pins HIGHI then have a function to load the Outlet_Screen and call the Outlet_Status function.The Outlet_Status is used to digitalRead the array, and then draw a fillCircle either green or red dependent upon whether the pin is HIGH or LOW.The results that I would expect is when I navigate to the Outlet Screen all fillCircles  would be drawn green since they are all set HIGH in void setup().However, I am getting no results at all. No fillCircles are being drawn and screen remains blank.I have tried it various ways, but have not yet figured out my issue.Any help locating where I have gone wrong would be appreciated. Thank you!Code:int OUTLETS[8] ={A8,A9,A10,A11,A12,A13,A14,A15};                    //set the pins in the arrayvoid setup(){for (int on=0; on<7; on++) pinMode(OUTLETS[on], OUTPUT);        //array sets outlet box pins as outputs for (int on=0; on<7; on++) digitalWrite(OUTLETS[on], HIGH);       //array sets outlet pins HIGH/ON} void Outlet_Screen(){        Outlet_Status();                                                                myGLCD.loadBitmap(0,0,240,252, "OUTLETS.raw");       //loads outlet screen      myGLCD.setColor(0,0,255);   myGLCD.drawRoundRect(8,309,231,255);                      //Draw Clock Button    } void Outlet_Status(){                      //Function indicates power status with Green or Red light   if (outlet_screen == true){   for (int on=0; on<7; on++) digitalRead(OUTLETS[on]);      if (OUTLETS[0] == HIGH){   myGLCD.setColor(0,255,0);           //outlets are default "ON"     myGLCD.fillCircle(101,51,11);       //Green Fill Circles will indicate this    }   else if (OUTLETS[0] == LOW){   myGLCD.setColor(255,0,0);           //outlet "OFF"     myGLCD.fillCircle(101,51,11);       //Red Fill Circle will indicate this   }      if (OUTLETS[1] == HIGH){   myGLCD.setColor(0,255,0);   myGLCD.fillCircle(101,94,11);   }   else if (OUTLETS[1] == LOW){   myGLCD.setColor(255,0,0);   myGLCD.fillCircle(101,94,11);    }   if (OUTLETS[2] == HIGH){   myGLCD.setColor(0,255,0);   myGLCD.fillCircle(101,137,11);   }      else if (OUTLETS[2] == LOW){   myGLCD.setColor(255,0,0);   myGLCD.fillCircle(101,137,11);    }      if (OUTLETS[3] == HIGH){   myGLCD.setColor(0,255,0);   myGLCD.fillCircle(101,181,11);   }   else if (OUTLETS[3] == LOW){   myGLCD.setColor(255,0,0);   myGLCD.fillCircle(101,181,11);    }     if (OUTLETS[4] == HIGH){   myGLCD.setColor(0,255,0);     myGLCD.fillCircle(222,51,11);   }   else if (OUTLETS[4] == LOW){   myGLCD.setColor(255,0,0);   myGLCD.fillCircle(222,51,11);    }    if (OUTLETS[5] == HIGH){   myGLCD.setColor(0,255,0);       myGLCD.fillCircle(222,95,11);   }   else if (OUTLETS[5] == LOW){   myGLCD.setColor(255,0,0);   myGLCD.fillCircle(222,95,11);   }      if (OUTLETS[6] == HIGH){   myGLCD.setColor(0,255,0);      myGLCD.fillCircle(222,137,11);   }   else if (OUTLETS[6] == LOW){   myGLCD.setColor(255,0,0);   myGLCD.fillCircle(222,137,11);    }   if (OUTLETS[7] == HIGH){   myGLCD.setColor(0,255,0);      myGLCD.fillCircle(222,181,11);   }   else if (OUTLETS[7] == LOW){   myGLCD.setColor(255,0,0);   myGLCD.fillCircle(222,181,11);    }   } }void loop(){      if (settings_screen == true){                if((y<=166) && (y>=121)){        if((x<=222) &&(x>=177)){          waitForIt(177,121,222,166);          x=0;          y=0;          settings_screen = false;          outlet_screen = true;          Outlet_Screen();        }       }      }
 13 Using Arduino / Storage / Data Logger to SD to LCD on: July 04, 2013, 10:42:00 pm I need a push in the right direction...or maybe a brick upside the head.I am looking to graph temperature data from an SD card onto a 3.2 TFT LCD. I would like to know what I should be researching/studying to make this happen?All my searches lead me to Processing and graphing to a computer via Serial port, but that's not exactly what I want.I would like to graph the data directly to this screenI would like it to default display current 7 days (in Green = 1), and then if I need I can call 7 days at a time each week a different color...Button numbers 1 through 4.Saving the data with the data logger to the SD card should be simple enough for me to handle.I would like to know how I should structure this code?Is there a simple code to set up the graph x & y coordinates?If so, I think I can then write a function to print the data to the LCD and use drawline from the UTFT library.I also want it to overwrite data older than the 28 days.Thanks for any help! I just need a good idea of how I should structure the code.
 14 Using Arduino / Programming Questions / What does this mean? on: June 19, 2013, 11:48:20 am if (home_screen == true){  if (Seconds % 4 == 0){    Print_Temp()I am unsure what % is in the programming language. This bit of code solved a problem I was having, but I would like to understand why it did.