Show Posts
Pages: 1 [2]
16  Using Arduino / Programming Questions / Re: Scope problem on: August 22, 2012, 02:26:14 pm
Try posting the actual code that the compiler is given rather than just the parts. If the problem was that obvious, you would ahve already found it.
17  Using Arduino / Programming Questions / Re: SD Library - Max files open on: August 20, 2012, 07:08:08 am
THe default SD library is built on top of an old version of the Sdfat library. The SD library limits the number of open files to 1 as far as I can tell. The latest Sdfat library (rather than the old one distributed with sd library) only limits the number of open files basaed on the RAM available. see,51087.0.html for example.

fatlib16 is the author of sdfat. sdfatlib20120719 is the latest version as far as I can tell.
18  Using Arduino / Programming Questions / Re: Can someone help me compact and clean up this code. on: August 19, 2012, 06:42:08 am
Try using arrays rather than having 5 similar named variables.

int Finger[ARRAYSIZE]= {0,1,2,3,4};

byte servoValue[ARRAYSIZE];

Then you can loop over the array rather than having multiple lines with just slightly different variable names.

for (byte loopCount =0; loopCount < ARRAYSIZE; loopCount++)
   servoValue[loopCount] = Function(FInger[loopCount]);

It will also help you spot all those unused variables. It is much easier to declare all the variables at the start of apiece of code rather than some at the start and some part way through.

Edit - OK Tom beat me to it but the same idea.
19  Using Arduino / Sensors / Re: Massive sensor noise/problems? on: August 16, 2012, 04:28:20 pm
Are you sure the line
MagX =<<8; //X msb
is working as you expect. The byte needs to be cast to an int, is this done before the shift or after? If before the cast then the values you are getting will all be zero. Might be worth putting a debug line in to check the values read for MagX make sense (also MagY and Z)

20  Using Arduino / Networking, Protocols, and Devices / Re: Open multiple sockets on Arduino Ethernet on: August 13, 2012, 01:13:32 pm
What sort of Arduino are you running this on? I ask as the Uno only has 2K memory iirc and you use 1514 for a buffer plus whatever the w5100 uses along with the various other arrays and variables you have.
21  Using Arduino / Sensors / Re: Massive sensor noise/problems? on: August 13, 2012, 08:48:52 am
When you only show two pieces of code that don't appear to have the error in it makes it very difficult to guess what he problem is - try posting ALL the code!

Are you sure you're reading the values in the same order you are writing them?
22  Using Arduino / Programming Questions / Re: For-Loop Questions and a Complex Biped on: August 13, 2012, 03:38:28 am
You need to post the whole code, especially if you are wanting to keep values in variables where teh definition of those variables and the location cannot be seen. It may be that you want to define them as static, or make them global, or defined at a differerent context.
23  Using Arduino / Programming Questions / Re: AD conversion adjustments. Look up table? on: August 03, 2012, 05:52:30 pm
If I understand the original question, it relates more as to where to store the correction factors (or whatever you prefer to call them). Assuming they do not change very often, for ease you could store them as an array in progmem or in eeprom
24  Using Arduino / Programming Questions / Re: checking two variables at once on: August 03, 2012, 09:26:59 am
You should have an OR in your while loop not an AND, so continue looping until both are zero.

You may also want to make sure the value does not drop below 0 when you leave the loop.
25  Using Arduino / Networking, Protocols, and Devices / Re: APC220 arduino setup help on: August 03, 2012, 09:23:15 am
Sounds like a similar probem to :,116837.0.html

The Arduino doesn't do rs232.
26  Using Arduino / Networking, Protocols, and Devices / Re: IR connection on: July 26, 2012, 07:04:09 am
If you want any help, I suggest you indicate what the problem is, how it occurs, and what if anything you have tried.
27  Using Arduino / Storage / Re: help me. Arduino with eeprom AT24c01 on: July 26, 2012, 06:21:21 am
Youare writing to add1 in both loops of your code, so the second loop overwrites the contents written by the first loop and the second address will be blank. Try altering your code to

  for(int i = 0; i < 16; i++)
  Serial.println("Write EEPROM 2"); 
  for(int i = 0; i < 16; i++)
    Wire.beginTransmission(add2);    //Previously add1
28  Using Arduino / Storage / Re: Problem reading SD card high bytes on: July 17, 2012, 08:22:40 am
2730 * 12 = 32760  which is the highest value you can get below 32767. 32767 being the highest value in a 16bit unsigned integer.

If you want to go further than record 2730 you will need to use a datatype larger than 16bit surely?
29  Using Arduino / Storage / Re: SD card access using variable as filename, file not found on: June 15, 2012, 01:11:20 pm
Surely you should null terminate the string, otherwise the receiving routine won't know how long the string is and will go through memory until it hits a null.
Pages: 1 [2]