Show Posts
Pages: [1] 2 3
1  Using Arduino / Programming Questions / Re: Using Globals or Passing Parameters to a Function on: October 19, 2012, 02:27:46 am
Hi,

Thanks for the heads up on the class constructor. I am finding the Jesse Liberty book very useful. If I understand correctly, the class would not pre-define those colours but provide the "placeholders" (not sure that's the correct term) for those values when an instance of the class is created.

As an aside I am creating some simple classes and trying them out to get the feel of how they work. There are other issues I will need to think about (such as using pointers instead of passing all the values as parameters) but I think I need to learn to walk first before I try running...

Thanks again,
Ric
2  Using Arduino / Programming Questions / Re: Using Globals or Passing Parameters to a Function on: October 18, 2012, 07:46:48 am
So the answer is to provide a class for handling the menus, and the parameters then become instance-variables in the class.

I am new to C++ and unfamiliar with classes but am reading up on it. I'm looking at the "Writing a library for the Arduino" tutorial and delving into my C++ book. I can see already that a class is an object and that I can create instances of it. I can already spot the candidates for the member functions or methods and shall do the same for the variables. Not sure yet about constructors but... that's something I can research.

Thanks for the suggestion,
Ric

3  Using Arduino / Programming Questions / Re: Creating a struct of RGB Values on: October 17, 2012, 12:47:32 pm

What is your problem, if you still have one?

None. Apologies for not making that clear. I was pointing out that the syntax I was looking for was of the form "main_menu.fill.r"
4  Using Arduino / Programming Questions / Using Globals or Passing Parameters to a Function on: October 17, 2012, 02:18:21 am
This is a question about best practice when using functions to repeat tasks. The attached sketch has the full code (less the UTFT libraries).

I am trying to create a menu handler for the 3.2" TFT Touch Screen using Henning Karlsen's UTFT library. I need to pre-define colours for menus with each menu "button" having:
  • a background colour
  • a border colour
  • a text colour
  • a text background colour (= background colour)

I have a struct to hold the RGB values:
Code:
struct RGB {
    byte r;
    byte g;
    byte b;
};

and a further struct to hold the menu colours as defined above:
Code:
struct BtnCol {
struct RGB fill;
struct RGB border;
struct RGB text;
};

I can now define various menu colours using the BtnCol struct as shown in this snippet:
Code:
    BtnCol vMain = {{0, 32, 0},{34, 139, 34},{144, 238, 144}};    // main (vertical) menu
    BtnCol hSubs = {{12, 78, 28},{56, 144, 64},{144, 238, 144}};  // subsidiary (horizontal) menu
    // etc....

I can create an array of menu items:

Code:
    // Up to 6 vertical menu items each of 1 to 9 characters
    const char* vMenuTxt [][6] = {
        {"Date-Time", "Co-ords", "Solar", "Equations", "Setup", "RESET"},  // 6 items
        {"Set Date", "Set Time", "Time Zone", "", "", "BACK"}
        // etc...
    };

...and to each of those items I can assign a colour from the previously-defined Button Colour struct:
Code:
    // assign appropriate menu colours to each of the above buttons
    BtnCol vMenu [][6] = {
        {{vMain}, {vMain}, {vMain}, {vMain}, {vMain}, {aWarn}},
        {{vMain}, {vMain}, {vMain}, {aGrey}, {aGrey}, {aSpec}}
    };

Menus are drawn using a generalised function:

Code:
void vDrawMenu (int menu, int vMOX, int vMOY, int vMP, int vBH, int vBW, int FW, int FH) {
    myGLCD.drawBitmap (1, 54, 78, 22, bmenu[menu]);
    for (int i=0; i<6; i++) {
        myGLCD.setBackColor(vMenu[menu][i].fill.r,vMenu[menu][i].fill.g,vMenu[menu][i].fill.b);   // Text Background, index 0
        myGLCD.setColor(vMenu[menu][i].fill.r,vMenu[menu][i].fill.g,vMenu[menu][i].fill.b);       // Button Fill, index 0
        myGLCD.fillRoundRect(vMOX, vMOY + i * vMP, vBW, vMOY + i * vMP + vBH);
   
        myGLCD.setColor(vMenu[menu][i].border.r,vMenu[menu][i].border.g,vMenu[menu][i].border.b); // Button Border, index 1
        myGLCD.drawRoundRect(vMOX, vMOY + i * vMP, vBW, vMOY + i * vMP + vBH);
   
        myGLCD.setColor(vMenu[menu][i].text.r,vMenu[menu][i].text.g,vMenu[menu][i].text.b);       // Text Colour, index 2
        int xpos = vMOX + vBW/2 - strlen(vMenuTxt[menu][i]) * FW/2;
        int vTextOffset = (vBH-FH)/2 + 3;
        myGLCD.print(vMenuTxt[menu][i], vMOX + xpos, vMOY + vTextOffset + i * vMP);
    }
}

All of the function arguments are positional. None of them are to do with the colour definitions. The specification of colours via the arrays previously defined at global level is handled by statements such as:
Code:
myGLCD.setColor(vMenu[menu][i].text.r,vMenu[menu][i].text.g,vMenu[menu][i].text.b);

This means that whilst positional information is passed via parameters, colour information is picked up directly from the global values.

I have read that globals ought not to be used this way so the question is:

Given that eventually I want to reduce the above function (as well as others) to a library, is the above way acceptable or are there better ways of organising this code? Or is it just down to personal preference?

(At the moment the button size and position parameters as well as the colours are defined in the sketch. Eventually they will be hived off to a separate file of user-definable values).

Thanks,
Ric
5  Using Arduino / Programming Questions / Re: Creating a struct of RGB Values on: October 17, 2012, 01:53:35 am

Do you mean like this?

Code:
BtnCol ..... etc
analogWrite( 3, main_menu.fill.r );

Yes, this is the bit:
Quote
main_menu.fill.r

Thanks!

6  Using Arduino / Programming Questions / Re: Creating a struct of RGB Values on: October 17, 2012, 01:48:04 am
Code:
struct RGB {
 uint8_t r;
 uint8_t g;
 uint8_t b;
};

On revisiting this question I realise I had overlooked your use of uint8_t instead of byte. What was your reason for this?

Thanks,
Ric
7  Using Arduino / Programming Questions / Re: Creating a struct of RGB Values on: October 17, 2012, 01:16:38 am
do you really need 24 bits per color?

For my purposes, no. 8 bit would indeed be god enough because only solid blocks/lines of colour are used and a 256 palette is probably going to look good anyway. The 3.2" TFT defaults to 24 bit colour but colour depth can be specified in the init section of the library.

Thank you for the suggestion.

Ric
8  Using Arduino / Programming Questions / Re: Creating a struct of RGB Values on: October 07, 2012, 02:21:09 pm
Yes, it works....

Clearly "main" is a reserved word in C++ and I had used it to reference something completely different. I keep forgetting I am working in C++ as well as the Arduino environment.

Now that this error has been corrected I still need to work out how to dereference the struct to derive the individual rgb values. Suggestions?

Thanks for your help guix.
Ric
9  Using Arduino / Programming Questions / Creating a struct of RGB Values on: October 07, 2012, 12:29:22 pm
I am writing a menu handler comprising a number of "buttons" using the UTFT library from here:

http://henningkarlsen.com/electronics/library.php?id=52

The aim is to simplify the creation of a number of menus. For the moment I need only consider the main menu structure which is represented by a single vertical column of "buttons".

This question addresses only the colour information required to display each "button".

Each button requires a number of colour values:
  • a fill colour
  • a border colour
  • a text colour

the background colour for the button fill is always the same as the background colour for the text, so only three parameters are required to define the colour of each button.

The first thing is to define a simple rgb struct in the header file:

Code:
#ifndef TFT_h
#define TFT_h

#include <Arduino.h>
// Each triad represents a single RGB colour
struct RGB {
    byte r;
    byte g;
    byte b;
};
#endif

the required rgb values for each colour required to build a button can be defined in a series of arrays:
Code:
   RGB vMenuFillCol[7]   = {{0, 32, 0},{12, 56, 28},{0,132,102},{0, 0, 0},{102,102,82},{250,250,250},{148,32,0}};  
    RGB vMenuBorderCol[7] = {{34, 139, 34},{56, 128, 64},{0,164,122},{32, 32,32},{132,132,102},{255,255,255},{164,36,12}};
    RGB vMenuTextCol[7]   = {{144, 238, 144},{144, 238, 144},{144,248,153},{144, 144, 126},{32,32,28},{0,0,0},{255,255,255}};

These 3 arrays define a set of different colours that can be assigned to each button

The text for each button (there are 6 vertical buttons always) can be defined by an array:

Code:
   char* MenuTxt [][6] = {
        {"Date-Time", "Co-ords", "Solar", "Equations", "Setup", "RESET"},  // up to 6 items for the main menu
        {"Set Date", "Set Time", "Time Zone", "", "", "BACK"}
    };

For the first main (vertical) menu the colour of each button can be defined using an array of rgb values:

Code:
   RGB MenuCol [3][6] = {
        {{vMenuFillCol[0]}, {vMenuFillCol[1]}, {vMenuFillCol[2]}, {vMenuFillCol[3]}, {vMenuFillCol[4]}, {vMenuFillCol[5]}},  // up to 6 items or greyed-out
        {{vMenuBorderCol[0]}, {vMenuBorderCol[1]}, {vMenuBorderCol[2]}, {vMenuBorderCol[3]}, {vMenuBorderCol[4]}, {vMenuBorderCol[5]}},
        {{vMenuTextCol[0]}, {vMenuTextCol[1]}, {vMenuTextCol[2]}, {vMenuTextCol[3]}, {vMenuTextCol[4]}, {vMenuTextCol[5]}}
    };

The above array defines the colours for the first set of menu buttons only (creating arrays for each set of menus (each comprising column of vertical buttons) is a problem to be solved later). For testing, most of the available colours (there are 7) are assigned to the 6 menu buttons. This bizarre arrangement of colours would never happen in practice, only in test....

I can define a menu function as follows:

Code:
void vDrawMenu (int menu, int vMOX, int vMOY, int vMP, int vBH, int vBW) {
    for (int i=0; i<6; i++) {
        myGLCD.setBackColor(MenuCol[0][i].r,MenuCol[0][i].g,MenuCol[0][i].b); // Text Background, index 0
        myGLCD.setColor(MenuCol[0][i].r,MenuCol[0][i].g,MenuCol[0][i].b);       // Button Fill, index 0
        myGLCD.fillRoundRect(vMOX, vMOY + i * vMP, vBW, vMOY + i * vMP + vBH);
        myGLCD.setColor(MenuCol[1][i].r,MenuCol[1][i].g,MenuCol[1][i].b);       // Button Border, index 1
        myGLCD.drawRoundRect(vMOX, vMOY + i * vMP, vBW, vMOY + i * vMP + vBH);
        myGLCD.setColor(MenuCol[2][i].r,MenuCol[2][i].g,MenuCol[2][i].b);       // Text Colour, index 2
        int xpos = vMOX + vBW/2 - strlen(MenuTxt[menu][i]) * MenuFontWidth/2;
        int vMenuTextOffsetY = (vBH-MenuFontHeight)/2 + 3;
        myGLCD.print(MenuTxt[menu][i], vMOX + xpos, vMOY + vMenuTextOffsetY + i * vMP); // 8 = v offset to centre vertically
    }
}

The function can be called as follows:
Code:
   vDrawMenu (0, vMenuOrigX,vMenuOrigY,vMenuPitch,vBtnHeight,vBtnWidth);

No colour information is passed by the function call, only positional information. Colour information is available via globals.

So far so good. It works and although somewhat clumsy )and probably at this stage far from good practice) it delivers the correct colour values for drawing each button. The full code is attached for those that wish to run it (but it requires a 3.2" TFT Touch screen to display the results, hence my extracting the key bits of the code to explain what I have been doing).

The problem
--------------
I am new to C++ and feeling my way into it. But this is an initial stab at a solution as well as an opportunity to learn.

Problems started when I tried to create another block of colours for the next menu (in this example it will be the menu starting:
Code:
{"Set Date", "Set Time", "Time Zone", "", "", "BACK"}

I first of all tried expanding the MenuCol array to a 3D array. I was never able to address the the 3D array correctly and colours were presented seemingly at random, even to the point of presenting colours that were to do with positional information. Clearly I was adressing the array incorrectly and visting areas of memory outside the new 3D array. I decided to put that aside...

Reading up on the inadvisability of creating 3D arrays in C++ I began to think there would be two better solutions:
  • using vectors
  • using a struct to hold the button information
Being new to C++ I realised a lot of learning would be required to implement vectors. Even then I was not sure it would be a good fit towards creating a generalised menu handler.

I opted to try the Struct approach.

I changed the header file as follows:
Code:

#ifndef TFT_h
#define TFT_h

#include <Arduino.h>
// Each triad represents a single RGB colour
struct RGB {
    byte r;
    byte g;
    byte b;
};

// Each triad of RGB colours represents a single fill, border and text colour respectively
struct BtnCol {
struct RGB fill;
struct RGB border;
struct RGB text;
};
#endif

struct BtnCol should now hold the triad of RGB values required to define each button. I also hoped it would result in a more readable display of each colour.

The next step is to create such a triad of rgb values:

Code:
   BtnCol main = {{0, 32, 0},{34, 139, 34},{144, 238, 144}};    // main (vertical) menu

This creates a compile error whcih I have been unable to resolve:

Quote
c:/program-arduino/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr6/crtm2560.o:(.init9+0x0): warning: internal error: out of range error

There may be other (better) ways to find a solution to assigning rgb values to each of the three elements that define a button's colour values and I will be interested to hear about those. The immediate question is: Why do I get the out of range error and how should I go about assigning values to what is, essentially, a struct of structs?

I hope I have made everything clear.

Thanks,
Ric

Note <ITDB02_Touch.h> is not needed in this example and can be commented-out.
10  Using Arduino / Programming Questions / Re: Not passing array correctly to function on: September 25, 2012, 07:57:07 am
Quote
From your usage of Collection, it looks like you're really trying to just create a 1 dimensional array of 6 points

The data in the array is for 6 points, each comprising an ordered pair, x,y. My understanding of the struct Point is that each instance of Point comprises two values, double x and double y. So yes, the array was set up (incorrectly (I might say, stupidly)) to provide just 6 data points.

Now that the array is correctly sized I can pass just "Collection" as I had it originally.

Really I am very grateful. Well spotted! Truly, well spotted!

Thanks,
Ric
11  Using Arduino / Programming Questions / Re: Not passing array correctly to function on: September 25, 2012, 07:15:33 am
You should pass Collection on its own. The array name (reference) is already a pointer to the array.

This is what I did originally but then the following error was given:

Quote
29: error: cannot convert 'Point (*)[2]' to 'Point*' for argument '1' to 'void leastSqrRegression(Point*, int)'

Code:
 leastSqrRegression(Collection, 6);

Ric
12  Using Arduino / Programming Questions / Not passing array correctly to function on: September 25, 2012, 05:27:33 am
Hi am thinking of using the algorithm provided here as the basis for determining the line of best fit:

http://codesam.blogspot.co.uk/2011/06/least-square-linear-regression-of-data.html?showComment=1348564757524

Here is the code adapted for the Arduino Mega:

Code:
#include <Wire.h>
#include <math.h>
//using namespace std;

struct Point
{
   double x;
   double y;
};

Point Collection [6][2] = {
    {1,9.3},
    {2,11.5},
    {3,12.25},
    {4,13.1},
    {5,14.2},
    {6,16.3}
};

void setup() {
    // fire up the serial interface for the monitor
    Serial.begin(115200);      // maximum for Mega 2560#
    // Set the headings and tab stops
    Serial.println("Linear Regression and Method of Least Squares");
    Serial.println("===================================================================================="); Serial.println();
}

void loop() {
  leastSqrRegression(*Collection, 6);
  while (1);
}

void leastSqrRegression(struct Point* xyCollection, int dataSize)
{
   if (xyCollection == NULL || dataSize == 0)
   {
      Serial.print("Empty data set!");
      return;
   }

   double SUMx = 0;     //sum of x values
   double SUMy = 0;     //sum of y values
   double SUMxy = 0;    //sum of x * y
   double SUMxx = 0;    //sum of x^2
   double SUMres = 0;   //sum of squared residue
   double res = 0;      //residue squared
   double slope = 0;    //slope of regression line
   double y_intercept = 0; //y intercept of regression line
   double SUM_Yres = 0; //sum of squared of the discrepancies
   double AVGy = 0;     //mean of y
   double AVGx = 0;     //mean of x
   double Yres = 0;     //squared of the discrepancies
   double Rsqr = 0;     //coefficient of determination

   //calculate various sums
   for (int i = 0; i < dataSize; i++)
   {
     Serial.print(i); Serial.print(" : "); Serial.print((xyCollection + i)->x); Serial.print("\t"); Serial.println((xyCollection + i)->y);
      //sum of x
      SUMx = SUMx + (xyCollection + i)->x;
      //sum of y
      SUMy = SUMy + (xyCollection + i)->y;
      //sum of squared x*y
      SUMxy = SUMxy + (xyCollection + i)->x * (xyCollection + i)->y;
      //sum of squared x
      SUMxx = SUMxx + (xyCollection + i)->x * (xyCollection + i)->x;
   }

   //calculate the means of x and y
   AVGy = SUMy / dataSize;
   AVGx = SUMx / dataSize;

   //slope or a1
   slope = (dataSize * SUMxy - SUMx * SUMy) / (dataSize * SUMxx - SUMx*SUMx);

   //y itercept or a0
   y_intercept = AVGy - slope * AVGx;
   Serial.println(); Serial.println("----------------------------------------------------------------------");
   Serial.print("x mean(AVGx) = "); Serial.print(AVGx); Serial.print("\t");
   Serial.print("y mean(AVGy) = "); Serial.println(AVGy);

   Serial.println ("The linear equation that best fits the given data:");
   Serial.print ("   y = "); Serial.print(slope); Serial.print(" * x + "); Serial.println(y_intercept);
   Serial.println ("----------------------------------------------------------------------");
   Serial.println ("   Original (x,y)   (y_i - y_avg)^2     (y_i - a_o - a_1*x_i)^2");
   Serial.println ("----------------------------------------------------------------------");

   //calculate squared residues, their sum etc.
   for (int i = 0; i < dataSize; i++)
   {
      //current (y_i - a0 - a1 * x_i)^2
      Yres = pow(((xyCollection + i)->y - y_intercept - (slope * (xyCollection + i)->x)), 2);

      //sum of (y_i - a0 - a1 * x_i)^2
      SUM_Yres += Yres;

      //current residue squared (y_i - AVGy)^2
      res = pow((xyCollection + i)->y - AVGy, 2);

      //sum of squared residues
      SUMres += res;
     
      Serial.print("\t");
      Serial.print((xyCollection + i)->x); Serial.print("\t");
      Serial.print((xyCollection + i)->y); Serial.print("\tres: ");
      Serial.print(res); Serial.print("\tYres: ");
      Serial.println(Yres);
   }

   //calculate r^2 coefficient of determination
   Rsqr = (SUMres - SUM_Yres) / SUMres;
   Serial.println();
   Serial.println("------------------------------------------------------------");
   Serial.print("Sum of (y_i - y_avg)^2 =             "); Serial.println(SUMres,3);
   Serial.print("Sum of (y_i - a_o - a_1*x_i)^2 =     "); Serial.println(SUM_Yres,3);
   Serial.print("Standard deviation(St) =             "); Serial.println( sqrt(SUMres / (dataSize - 1)),3);
   Serial.print("Standard error of the estimate(Sr) = "); Serial.println(sqrt(SUM_Yres / (dataSize-2)),3);
   Serial.print("Coefficent of determination(r^2) =   "); Serial.println((SUMres - SUM_Yres)/SUMres,3);
   Serial.print("Correlation coefficient(r) =         "); Serial.println(sqrt(Rsqr),3);
}

The code is almost working. Equally it is not working at all as expected.

Here is the sample output:

Quote
Linear Regression and Method of Least Squares
====================================================================================

0 : 1.00   9.30
1 : 0.00   0.00
2 : 2.00   11.50
3 : 0.00   0.00
4 : 3.00   12.25
5 : 0.00   0.00

----------------------------------------------------------------------
x mean(AVGx) = 1.00   y mean(AVGy) = 5.51
The linear equation that best fits the given data:
   y = 4.50 * x + 1.01
----------------------------------------------------------------------
   Original (x,y)   (y_i - y_avg)^2     (y_i - a_o - a_1*x_i)^2
----------------------------------------------------------------------
   1.00   9.30   res: 14.38   Yres: 14.38
   0.00   0.00   res: 30.34   Yres: 1.02
   2.00   11.50   res: 35.90   Yres: 2.23
   0.00   0.00   res: 30.34   Yres: 1.02
   3.00   12.25   res: 45.45   Yres: 5.10
   0.00   0.00   res: 30.34   Yres: 1.02

------------------------------------------------------------
Sum of (y_i - y_avg)^2 =             186.752
Sum of (y_i - a_o - a_1*x_i)^2 =     24.752
Standard deviation(St) =             6.111
Standard error of the estimate(Sr) = 2.488
Coefficent of determination(r^2) =   0.867
Correlation coefficient(r) =         0.931

As you can see I have added a few additional print statements to highlight what is happening in the first loop. It seems as if the array is not being passed correctly. The first data pair is {1,9.3} which is passed OK; the second data pair appears as (0,0); the third data pair is in fact the second pair {2,11.5} and so on. The correct solution should be f(x) = 1.28 * x + 8.3143.

I have been racking my brains on this for hours and finally given in. It is not likely the loop is incrementing incorrectly so either the pointer to the array is not being passed correctly or the loop is not accessing the pointers correctly and therefore failing to point to the correct data values. Can anyone help me spot where I have introduced an error (and why)?

Thanks,
Ric
13  Using Arduino / Programming Questions / Re: Double Precision Advice on: September 03, 2012, 05:06:13 pm
If you just want to find the sun's position (given latitude, longitude, date, and time) try the sketch here:

http://arduino.cc/forum/index.php?topic=72084.0

Hi,

Thank you for the reference. This is based on the sunpos library from Spanish-based "Plataforma Solar de AlmerĂ­a" (PSA)  which is, to quote the website:
"The largest concentrating solar technology research, development and test center in Europe"
Its prime goal is the research and development underpinning the commercial and industrial concentrating of solar thermal energy.

It has produced two C++ libraries that can be refenced by appropriate software:
http://www.psa.es/sdg/sunpos.htm

I use this library as one of my references. It is also the basis of the algorithm made popular by Mowcius (see http://arduino.cc/forum/index.php/topic,8620.0/wap2.html) but is in fact the work of Blanco & Muriel. The algorithm works well but has significant rounding errors used natively on the Arduino.

Ric
14  Using Arduino / Programming Questions / Re: Double Precision Advice on: September 03, 2012, 03:21:21 pm
Hello everyone,

I am sorry my reply is so late but I have found the issues involved a challenge to my free time and understanding but nonetheless a great learning opportunity.

First: long integer calculation. I did not quite understand this at first but after a 'playful' approach to the problem I realised that by upscaling, a long integer could hold the required number of significant digits. I have a result as an unsigned long int with the last three significant figures corresponding to 3 d.p. precision. Quite reasonable.

The other thing that I noticed is that by looking at the maths it was possible to split the calculation into a full integer part and a fractional part. Looking ahead to the later calculations not all algorithms will yield to this technique but, where approriate and possible, it has great merit.

By sidestepping the issues and not simply bemoaning the fact that double precision is not possible on the Arduino, I have been able to calculate an essential interim value to 8 d.p. precison. Somehwhat better than I had imagined. There are many calulations yet to achieve and since precision and accuracy, not speed, is prime, I can afford for now to be equally 'playful' on the remaining algorithms.

I think the important thing is to be guided by the maths and to spot opportunities and alternatives where possible. It pays to be sneaky it seems.

For those interested I am creating a library for the calculation of solar co-ordinates that at least stands up to those published by NOAA and the USNO. It will be some weeks before I get to the final calculation of elevation (altitude) and azimuth, but I will post again to round-off this question.

As an aside, and also as a parallel investigation, I have just taken delivery of a floating point coprocessor as suggested by Wanderson:
Quote
"Instead of trying to implement a double precision library within the arduino, consider purchasing a coprocessor like this; http://www.micromegacorp.com/umfpu64.html  that would let you off load all of the math to a second chip designed to perform that math with the precision you need...  That would greatly simplify the infrastructure code you need for your project."

I have also yet to have a look at "big numbers" suggested by Nick Gammon:

Quote
"Big Numbers!
http://www.gammon.com.au/forum/?id=11519
Although there is a saying "after the 3rd decimal place no-one gives a damn". So I don't know if you really need that much precision."

The answer to your implied question is "yes". (but perhaps also "no" because there are alternatives). After getting most of the maths in place I will need to turn my attention to what I thought was going to be my starting point: the development of an accurate solar positional sensor. Almost straight away I realised that I could do with a reference to measure the difference between detected solar position and known solar position. So the answer is "no" if I do a spreadsheet analysis. The answer is "yes" if I let the Arduino do it all. The latter is much more fun!

Ric

15  Using Arduino / Programming Questions / Re: Function to return custom Data Type on: September 01, 2012, 05:05:34 am
pYro_65, our posts crossed.

Thanks for your suggestions - you were spot on! The voice of experience smiley

Ric
Pages: [1] 2 3