Show Posts
Pages: 1 ... 282 283 [284] 285 286 ... 411
4246  Using Arduino / Programming Questions / Re: millis rollover on: November 30, 2011, 03:16:48 pm
it can cause the arduino to lock up.
The term "lock up" is so over used that it is meaningless.  Mishandled events could cause code to operate unexpectedly, but the microcontroller will still continue to execute instructions.

You might be interested in this write up on handling roll over:
http://www.arduino.cc/playground/Code/TimingRollover
4247  Using Arduino / Programming Questions / Re: C++ code converting to Arduino on: November 30, 2011, 03:11:33 pm
About the syntax errors, that's the problem, I'm not familiar with Arduino languge, so I couldn't figure out what kind of error I made.
Again, there is no such thing as "Arduino language."  The Arduino is programmed with C++.  Your syntax errors are C++ errors.

Code:
   for (i=0; i<nterms; i++){
      a = 1;
   }
a is an array.  So what does a = 1 mean?  You do this again later on in func():
Code:
value = c[2]*x + c[1]/x + c[0];   /*van deemter equation*/
x is an array. 

As AWOL points out, if you are getting errors you need to ask about the specific errors.  Just posting code and saying "this doesn't work" won't you get any closer to a solution.  You need to explain what isn't working.
4248  Using Arduino / Programming Questions / Re: C++ code converting to Arduino on: November 30, 2011, 01:18:57 pm
Sorry that I didn't mentioned this is just Sub-function of program.
Posting only parts of code makes it difficult to help troubleshoot.  You might have identified the part that is not working, but the cause could be elsewhere.

I'm using 'Ardupilot Mega' (126kb) board, and I'm using only 15kb except this code.so I don't think this is the capacity problem.
We are not suggesting a capacity problem.  Code is stored in Flash Memory which is 128kb.  Your program runs in SRAM which is only 8k...  The complier does not report or check if you are using too much SRAM.

As I told, I need to check that I put wrong command or unusual expression on the code.
The code, as posted, has many syntax errors.  Most members of this forum will not troubleshoot code that does not compi unless the question is "why doesn't this compile?".
4249  Using Arduino / Programming Questions / Re: C++ code converting to Arduino on: November 30, 2011, 12:50:36 pm
Quote
This is my Arduino Code.
The problem is C++ code find the correct function, but Arduino is not.
There is no such thing as "Arduino Code."  Arduino is coded in C++.

Code:
int param, iteration, nloops, n, cycle, nfree;
12 bytes

int npts;   /* Number of data pairs */
2 bytes

double x[maxnpts], y[maxnpts], sigmay[maxnpts]; /*x,y,y, uncertainty*/
156 Bytes

double weight[maxnpts];  /*Weighting factor*/
52 Bytes

double yfit[maxnpts]; /*calculated values of y*/
52 Bytes

double a[nterms], sigmaa[nterms], b[nterms]; /*a=c params*/
36 Bytes

double beta[nterms], c[nterms]; /*To be fit by program*/
24 Bytes

double finala[nterms], lastsigmaa[nterms];
24 bytes

double alpha[nterms][nterms], arry[nterms][nterms];
72 Bytes  // someone may need to check me on this one

double aug[nterms][nterms*2];   /*For matrix inversion */
72 Bytes

double deriv[maxnpts][nterms];   /*Derivatives */
36 Bytes

double flambda; /*Proportion of gradient search(=0.001 at start)*/
4 Bytes

double chisq; /*Variance of residuals in curve fit*/
4 Bytes

double chisq1, fchisq, sy;
12 Bytes

Right out of the gate you are using 558 bytes of SRAM be mindful of that.

If you are compiling this code in the Arduino IDE you should have a void setup() function that does any one time operations (like Serial.begin()) and a void loop() which is much like a void main().  Neither of those appear in the code you posted.  Additionally there are many places in your code where you refer to arrays like 'a' and 'x' but don't give any indexes.  So the code you have posted doesn't even compile.
4250  Community / Website and Forum / Re: This is an old picture, right? on: November 30, 2011, 02:07:55 am
And, unlike the original Uno launch photos, the ATmel isn't installed backwards.
4251  Community / Website and Forum / Re: Should we get rid of polls? on: November 30, 2011, 02:06:29 am
It seems to me that if polls were disabled unless your post count was above 1, this issue would be addressed.
4252  General Category / General Discussion / Re: Any chance of getting this tutorial changed? on: November 30, 2011, 02:02:22 am
My vote for rights to change arduino.cc goes to everyone who has replied until this post.

Why not?  You guys, politely, correct the mistakes and answer the questions in the forum anyway...
4253  Using Arduino / Programming Questions / Re: Interrupt program not working on: November 30, 2011, 01:51:50 am
Use this circuit:
http://www.arduino.cc/en/Tutorial/button
4254  Using Arduino / Installation & Troubleshooting / Re: Replacement for Blown D1 Diode on Arduino Nano on: November 30, 2011, 01:18:56 am
Diodes are cheap.  Would you rather a more expensive component on the board die instead?
4255  Using Arduino / Programming Questions / Re: Does my bootloader support watchdog timer? on: November 30, 2011, 01:02:07 am
Maybe I am missing something, but why would the bootloader have anything to do with the watchdog timer?
4256  Using Arduino / Programming Questions / Re: Example of interrupt-based version of reading serial port on: November 30, 2011, 01:00:08 am
Timing this, it shows that the reaction time to turn the LED on, after the third byte has arrived, is 19.375 uS. This then is reacting 2580 times as fast as you need it to, so that is plenty fast enough. Plenty of time in fact to be doing other things as well.
Nick, you continue to impress me with the steps you take to help people in this forum. 

Nice work!
4257  Using Arduino / Programming Questions / Re: Interrupt program not working on: November 30, 2011, 12:44:51 am
Interrupt 0 uses pin 2.  What have you attached to Pin2?   Your program doesn't enable the internal pull-up resistors so are you using external pull-ups (or pull-downs)?
4258  Using Arduino / Installation & Troubleshooting / Re: Problems uploading sketch from Macbook Pro on: November 30, 2011, 12:15:42 am
Try the other USB port.
4259  Using Arduino / Installation & Troubleshooting / Re: Replacement for Blown D1 Diode on Arduino Nano on: November 30, 2011, 12:13:55 am
Why would replacing it with one with a higher rated current make you "better off"?
4260  Using Arduino / Programming Questions / Re: I2C lcd on: November 29, 2011, 11:54:04 pm
Download this Liquid I2C library:
http://hmario.home.xs4all.nl/arduino/LiquidCrystal_I2C/

Unzip it and put it in your libraries folder.  If you don't have a libraries folder, where your other Arduino sketches are stored, create one.
Pages: 1 ... 282 283 [284] 285 286 ... 411