Show Posts
Pages: 1 ... 54 55 [56] 57 58 ... 79
826  Using Arduino / Programming Questions / Re: nan (not a number) on: April 30, 2013, 08:50:01 am
Just for the record, if you don't have isnan(), you can compare it to itself with the == operator - if(x==x) - only a NaN will fail this test.
827  Using Arduino / Programming Questions / Re: Smooth sine wave transition on: April 29, 2013, 06:04:36 pm
Just draw the curve, *all* sinewaves tranistion through zero, so if you change there, there is no discontinuity, just a change in slope. Just like BPSK.
828  Using Arduino / Programming Questions / Re: Smooth sine wave transition on: April 29, 2013, 05:57:42 pm
I suggest you wait until the sine is at a zero crossing to implement the frequency change.
829  Using Arduino / Programming Questions / Re: SVD Matrix manipulation on: April 29, 2013, 05:54:34 pm
Is it known by another name? Matlab knows nothing of it.

I think you would be best hard-coding your own.
830  Using Arduino / Programming Questions / Re: nan (not a number) on: April 29, 2013, 05:21:33 pm
Can you at least print the commands that send the number to the serial port?

Is it a float? double?
Do some values work? What values choke?

Could you be dividing by zero?

C'mon, work with us here!
831  Using Arduino / General Electronics / Re: ADC + OP-AMP only generate positive numbers. on: April 29, 2013, 05:18:03 pm
A single-supply op-amp cannot supply negative voltage. You will need dual supplies.
832  Using Arduino / General Electronics / Re: what is the purpose of latch, clock, data? (new) on: April 29, 2013, 01:49:07 pm
Ask a question like that without context and what do you expect?
833  Using Arduino / Project Guidance / Re: Sine wave table on: April 29, 2013, 12:06:25 pm
There is an error in my formula. I leave it to the interested student to find it...
834  Using Arduino / Project Guidance / Re: Sine wave table on: April 29, 2013, 12:00:16 pm
If you want 256 levels in your table, you would compute sin((x/256)*2*pi) for i=0 to 255. This gives you a result between -1 and +1, so to fit it in 256 levels you would multiply by 256 and add 128. Round to the nearest whole number. An excel spreadsheet will make the calculations really easy.
835  Using Arduino / Project Guidance / Re: Sine wave table on: April 29, 2013, 11:44:07 am
Is this an AC or DC motor? AC motors are *very* uncommon in these kinds of applications.
836  Using Arduino / Project Guidance / Re: Sine wave table on: April 29, 2013, 11:33:44 am
You are the programmer, you decide! Try it both ways - see which works.

However, the arduino is not very fast at floating point - it has no FPU - so precomputing is much faster, but uses up more memory. So it is a tradeoff between speed and space.
837  Using Arduino / Programming Questions / Re: pointer and strings on: April 25, 2013, 04:27:08 pm
_string is already a pointer, so you don't need to dereference it.

You wouldn't say println(*string), right? I am not sure where you stored your array, but it wasn't in string.
838  Using Arduino / Programming Questions / Re: stdlib Library - float to string on: April 25, 2013, 01:36:31 pm
It simply replaces the statement that doesn't work. It builds the dataString string.
839  Using Arduino / Programming Questions / Re: HEX to RGB and RGB to HEX. on: April 25, 2013, 01:25:16 pm
The C++ ones should work fine. Why won't they work in arduino?

But this should work:
Code:
byte red, green, blue;
unsigned long rgb = 0x6f56a3;

red = rgb >> 16

green = (rgb & 0x00ff00) >> 8;

blue = (rgb & 0x0000ff);

rgb = 0;

rgb |= red <<16;
rgb |= blue <<8;
rgb |=green;
840  Using Arduino / Programming Questions / Re: What sketch is loaded? on: April 25, 2013, 12:04:00 pm
So I assume Serial.println(F(__file__));

would work, too.
Pages: 1 ... 54 55 [56] 57 58 ... 79