Show Posts
Pages: 1 ... 24 25 [26] 27 28 ... 97
376  Using Arduino / Programming Questions / Re: GPS data analysis on: August 18, 2013, 10:45:36 am
The lines you are printing are quite long. The serial output buffer is (IIRC) 32 bytes, so the output will block until there's less than 32 bytes in the buffer. Changing the amount of data printed changes the timing of when, how often and for how long it blocks.
Simplest thing is to change the serial output speed (and the serial monitor) to 57600 or even higher.

Pete
377  Using Arduino / Sensors / Re: FIR Filter Code _ not getting reasonable results on: August 16, 2013, 03:49:10 pm
As I say, I have only played with FIR filters but there are a couple of things that seem to be wrong.

You have specified a cutoff frequency of 7kHz which means that your sampling rate must be considerably more than double that. For an FIR to work, the samples must all be collected at a fixed sampling rate. I can't find anything in your code which does this.

In my (limited) experience, when an FIR is run, it is done continuously on every input sample. This requires some form of circular buffer. That is, when you input a new sample, the FIR is run on that sample and the previous M samples which then produces a new output value. On the next sample, you throw out the oldest sample and then run the FIR again. Your code generates a block of samples at some varying rate, does an FIR on them and then throws those away and starts on a new block.

Pete
378  Using Arduino / Sensors / Re: FIR Filter Code _ not getting reasonable results on: August 16, 2013, 02:55:16 pm
The PI problem can be fixed by replacing each occurrence of 22/7 by 3.141592654

I don't know enough about FIR filters to help you with the specifics of your application.
But, why are you using a high-pass filter and how do you know that what you are getting is wrong?
The data shown in Capture.JPG looks like the filtered output is a sawtooth waveform.

Pete
379  Using Arduino / Sensors / Re: FIR Filter Code _ not getting reasonable results on: August 16, 2013, 01:01:53 pm
You need to post all of your code.

Code:
      b[z] = -(sin(2*(22/7)*fr*(z - (m/2)))/((22/7)*(z - (m/2))));

This isn't going to work very well because it uses the value 3 for PI. The term (22/7) is an integer division which throws away the fractional part, resulting in 3. Even if you change it to use floating point (22./7.) it is still not a good approximation to PI and will throw off the results.

Pete
380  Using Arduino / Sensors / Re: FIR Filter Code _ not getting reasonable results on: August 16, 2013, 12:13:40 pm
First thing to do is post your code properly. Read this: How to post code properly

Pete
381  Using Arduino / Networking, Protocols, and Devices / Re: Issues with GPRS code on: August 16, 2013, 11:30:54 am
You allocated String objects in the loop() and Response() functions and that caused problems. Allocating one inside a different function is not going to improve things. You have to get rid of them altogether.

Quote
I had some problems concatenating strings (char arrays) and int's.
You can use sprintf to create a string from strings and integers. E.g.

Code:
  char result[32];
  int i = 42;
  char answer = "The answer";

  sprintf(result,"%s is %d",answer,i);
Will generate "The answer is 42".

Pete
382  Using Arduino / Audio / Re: selective call system with musical notes. on: August 16, 2013, 11:23:00 am
There are some problems you don't seem to have considered.
1. The tone that is generated is a pulse-width modulated square wave - not a sine wave. Transmitting a square wave over a radio will cause a lot of interference. You would have to filter the signal to remove harmonics before injecting it into a microphone.

2. Existing tone generation systems rely on hardware within the radio to control the squelch. A sub-audible tone decoder only opens the squelch if the selected tone is received. In your scheme the squelch would have to be open all the time and everyone on the same frequency will hear the tones you are sending. Apart from being annoying, it might be illegal.

3. How are you going to decode the tones at the receiving end? This is not a trivial process, especially when looking for a sequence of 5 tones.

Pete
383  Using Arduino / Programming Questions / Re: Error in my code - please help on: August 15, 2013, 04:06:48 pm
What is this supposed to do?
Code:
  if (val = >++);

Pete
384  Using Arduino / Networking, Protocols, and Devices / Re: Issues with GPRS code on: August 15, 2013, 12:38:29 pm
The problem is almost certainly your use of String in the loop() and Response() functions. You collect the string in a C-style char array but then convert it to String to look for "Call Ready" or "ERROR". You should do the whole thing with C-style null-terminated strings and then you won't run into garbage collection problems with the use of the String class.

Pete
385  Using Arduino / Audio / Re: How to do a DDS synth on Due with multiple waves. on: August 14, 2013, 10:16:21 am
You should have posted this in the DUE forum, but since you're here this code isn't right:
Code:
  if(accumulator >= oneHzSample)
    i++;
    accumulator = accumulator - oneHzSample;

If the accumulator value exceeds oneHzSample you increment i. But you *always* subtract oneHzSample from accumulator.

I think you need this?:
Code:
  if(accumulator >= oneHzSample) {
    i++;
    accumulator = accumulator - oneHzSample;
  }

Pete
386  Using Arduino / Programming Questions / Re: need help with error: expected unqualified-id before '{' token on: August 12, 2013, 04:50:34 pm
Familiarize yourself with this How to post code properly
and then fix up your post so that your code displays properly.

Pete
387  Using Arduino / Programming Questions / Re: voice recognisation kit AND Arduino Uno on: August 12, 2013, 02:52:38 pm
You still aren't posting your code properly. Read this: How to post code properly

Pete
388  Using Arduino / Programming Questions / Re: Losing my rag now.. on: August 10, 2013, 04:09:46 pm
You mean it gives exactly the same error or it still doesn't compile?
Show the error message.

Pete
389  Using Arduino / Programming Questions / Re: Losing my rag now.. on: August 10, 2013, 04:06:35 pm
Get rid of the closing brace before the if statement.

Pete
390  Using Arduino / Programming Questions / Re: 16bit math on: August 08, 2013, 08:20:49 pm
It's because the result of 1249 * 79 = 98671 is too large to fit into a 16-bit integer. You have to force the computation to use 32-bit (long) integer arithmetic and then it will work.
Code:
C = (long)A * B / 100;

Pete
Pages: 1 ... 24 25 [26] 27 28 ... 97