Show Posts
Pages: 1 ... 26 27 [28] 29 30 ... 96
406  Using Arduino / Storage / Re: using sd.exist(file) and sd.mkdir when having file in a directory on: July 30, 2013, 10:17:15 am
You close the SD file inside the for loop. Not a good idea.

Pete
407  Using Arduino / Programming Questions / Re: Help with code!!!! on: July 29, 2013, 02:19:13 pm
Click on this link: How to post code properly
Read it. Do it.

Pete
408  Using Arduino / Programming Questions / Re: Capacitive Sensing in Teensy 3.0 on: July 28, 2013, 06:46:36 pm
That library does not use the touch sensing capability of the Teensy 3. If I read it correctly, it was written to work on a Nano or Uno etc. It measures the capacitance between two pins by grounding one of them (in your case pin 16) and timing how long it takes for the other pin to drop below a threshold value.

You don't need to do this on Teensy 3. The touchRead function works just like the analogRead function except that it reads capacitance instead of voltage.

Try this demo sketch I've just tried out on my T3.
It just prints the value received by touchRead on Teensy3 pin 23 (A9).
When the wire is touched, the sketch prints a number above 2000. When the wire isn't being touched the number is around 800.

Code:
void setup(void)
{
  Serial.begin(9600);
}

void loop(void)
{
  Serial.println(touchRead(23));
  delay(200);
}

Pete
409  Using Arduino / Storage / Re: using sd.exist(file) and sd.mkdir when having file in a directory on: July 28, 2013, 05:49:09 pm
Put your code in code tags: How to post code properly

Pete
410  Using Arduino / Programming Questions / Re: Capacitive Sensing in Teensy 3.0 on: July 28, 2013, 05:28:17 pm
You'd be a lot better off asking this in the PJRC forum, which is for Teensy: http://forum.pjrc.com/forum.php

Pete
411  Using Arduino / Programming Questions / Re: Problem using Wire library and interrupts on: July 28, 2013, 03:18:46 pm
Your code doesn't do anything sensible.

Code:
  Wire.beginTransmission(0x68);
  Wire.write((byte)0);
  Wire.endTransmission();
This just tells the realtime clock that you are going to read or write to/from its register zero, but then you do neither. It is also NOT a good idea to send to the clock so frequently because it will make the clock drift much faster than it would normally.

Code:
  Serial.println("Test point: 1");
  sei(); delay(1000); cli();
  Serial.println("Test point: 2");

This prints a message, turns interrupts on (why?), waits a second, turns interrupts off (WHY?) and prints another message (with interrupts off, maybe it doesn't print).

I think the RTC might, by default, output a 1Hz signal. If it does, and if you have the SQW signal connected to the correct pin, an interrupt will occur once every second. This will cause the interrupt routine to increment puls but you don't do anything with it so I can't see how you know whether or not the clock is interrupting. Turning off interrupts is also going to complicate things.

Now, what did you actually want it be doing?

Pete
412  Using Arduino / Programming Questions / Re: DS3234, interrupts and alarms on: July 28, 2013, 02:46:21 pm
I can't see if you are doing this, but when an alarm occurs you must clear the INTCN bit (bit 2) in the control register to reset it ready for the next alarm. You would do this in the loop() function each time that time_interrupt is set.

I also think it would be a lot easier to just set the alarm to interrupt every minute. You then initialize a counter to sleep_period and count it down on each interrupt until it reaches zero. That would avoid having to calculate the next value required for the alarm.

Pete

413  Using Arduino / Audio / Re: Help using ArduinoFFT on: July 26, 2013, 10:31:06 am
Quote
the 0th frequency is the most dominant, and the 128th frequency is the least dominant

No, that's not it at all. As g_u_e_s_t has explained, each bin represents a range of frequencies. The 0th bin has the amplitude of the zero frequency (DC) component of the signal. The next bin will have the amplitude of frequencies around 150Hz, then 300Hz etc. up to the 127th bin with the amplitude of frequencies around 19050Hz.
If you want to know the frequency with the highest amplitude you would have to search the array to find the highest amplitude and then the index of that entry multiplied by 150 gives its frequency.

Pete
414  Using Arduino / Project Guidance / Re: TMRPCM WAV file player noisy sound before and after playing a wav file on: July 24, 2013, 09:34:03 pm
Sorry, I don't know of any other players.

Pete
415  Using Arduino / Audio / Re: Help using ArduinoFFT on: July 24, 2013, 06:25:01 pm
You need to flush the serial buffer before collecting the next batch of samples.

Code:
    for (int i = 0; i< FHT_N/2; i++)
    {
      Serial.println(fht_log_out[i]);
    }
    Serial.flush();

Pete
416  Using Arduino / Audio / Re: Help using ArduinoFFT on: July 24, 2013, 10:48:10 am
Quote
There is a Pure Data patch for visualising the data.
The serial output of the example code is intended to be used as input to Pure Data (http://puredata.info/). It doesn't say where/what the patch is. I have never used Pure Data so I can't help with it other than to say that it runs on your PC and provides visualization of the data from the FFT.

At the end of the example code:
Code:
  Serial.write(255); // send a start byte
  Serial.write(fft_log_out, 128); // send out the data
this sends the data out the serial port. You could replace it with your own code. The magnitudes (amplitudes) of the result of the FFT are the 128 values in the fft_log_out array.

Pete
417  Using Arduino / Project Guidance / Re: TMRPCM WAV file player noisy sound before and after playing a wav file on: July 23, 2013, 10:52:21 pm
This is just a stab in the dark but I can't figure out what this initialization accomplishes (in the play method of TMRpcm.cpp):
Code:
    for(int i=0; i<buffSize; i++){ buffer[0][i] = i,buffSize; }
    for(int i=0; i<buffSize; i++){ buffer[1][i] = i+buffSize;  }
In particular, the "i,buffSize;" in the first for loop is strange. I'd suggest that you try changing it to this:
Code:
    for(int i=0; i<buffSize; i++){ buffer[0][i] = 0; }
    for(int i=0; i<buffSize; i++){ buffer[1][i] = 0;  }
If it doesn't mangle the audio altogether, I'd be interested to know if it gets rid of the noise at the beginning.

Pete
418  Using Arduino / Storage / Re: How much data i can transfer using sd card from arduino to other device? on: July 23, 2013, 12:57:15 pm
The files can be very large (up to at least 4GB I believe), but I don't see how you are going to generate a powerpoint file on the Arduino. An image file isn't going to be easy either unless it is a very basic BMP or raw image.

Pete
419  Using Arduino / Programming Questions / Re: CAN ANYONE KINDLY HELP ME GET STARTED? on: July 22, 2013, 07:31:03 pm
Start here: How to use this forum

Pete
420  Using Arduino / Project Guidance / Re: Help With Code To Receive and Process ASCII From Industrial Machine on: July 22, 2013, 02:30:07 pm
Converting that to ASCII it is this:
Code:
22<24^99^FLOW^<[160][137]S[243]CM^PASS

where I have represented the TAB character (9) by ^
and the numbers in square brackets, e.g. [160], are not ASCII characters so I left them as they were. The line ends with carriage return and line feed.

Pete
Pages: 1 ... 26 27 [28] 29 30 ... 96