Show Posts
Pages: 1 ... 24 25 [26] 27 28 ... 106
376  Using Arduino / Interfacing w/ Software on the Computer / Re: Help With DS18B20 Values on: November 19, 2013, 09:21:40 pm
I don't know if the DallasTemperature library does the delay for you but just in case it doesn't, after this statement in loop():
Code:
  sensors.requestTemperatures(); // Send the command to get temperatures
add
Code:
  delay(100);
just to be sure.

Pete
377  Using Arduino / Interfacing w/ Software on the Computer / Re: Help With DS18B20 Values on: November 19, 2013, 08:35:22 pm
Quote
but I understand that is to enable it to flush itself between readings
Eh? It requires a delay because it takes time for it to do the temperature conversion depending upon the number of bits of resolution. The OP has set it to 9 bits so according to the datasheet (page smiley-cool it requires 93.75ms to do the conversion.

Pete
378  Using Arduino / Programming Questions / Re: Smoothing analog input values...... on: November 19, 2013, 01:19:56 pm
Quote
After all, the effect of the initial 0 is gone after 45 steps.
That is only because of the finite precision of a 16-bit word and the integer division. If this were done in 64-bit floating point, the initial values would still be having an impact long after the code started.
Depending upon the application and the sampling rate, 45 steps might be unacceptable.

Quote
A full average of all the steps is still 900.

All which steps?

Pete
379  Using Arduino / Programming Questions / Re: Smoothing analog input values...... on: November 19, 2013, 01:01:49 pm
It is not an average of the last 8 inputs. It is an average of every input since the program started.
As KeithRB has said, there's a problem with integer truncation too. It works a bit better if you use this:
Code:
  _eleAvg = (_eleAvg * 7 + smoothEle)/8;

Pete
380  Using Arduino / Microcontrollers / Re: I have a perfectly valid sketch.. that bricks Leonardo. on: November 18, 2013, 06:55:06 pm
You use the String class in two functions. The String class always causes grief because it can't work effectively with a small amount of memory. A Leonardo has 2.5kB static ram which is only marginally more than in a UNO.
You should change all uses of the String class to null-terminated C strings.

Pete
381  Community / Bar Sport / Re: Finally, a use for spam! on: November 18, 2013, 03:17:30 pm
Quote
You do not want to filter mail disguised as spam to be filtered.
I realize that and I'm sure the NSA does too.

Pete
382  Community / Bar Sport / Re: Finally, a use for spam! on: November 18, 2013, 10:52:37 am
If anyone can come up with a really effective spam filter, the NSA ought to be able to do it, and probably have. But they'll keep it secret for a hundred years.

Pete
383  Using Arduino / Project Guidance / Re: What is wrong with my coding as the GPS gives the lattitude and longitude = 0. on: November 16, 2013, 10:30:07 am
And read this carefully: How to post code properly

and then fix up the code in your post so that it has code tags.

Pete
384  Using Arduino / Networking, Protocols, and Devices / Re: Scanning for I2C devices.... on: November 15, 2013, 11:59:16 am
If you don't like that one, try Nick Gammon's I2C scanner:
http://www.gammon.com.au/forum/?id=10896&reply=6#reply6

Pete
385  Using Arduino / Programming Questions / Re: how to make code restart on: November 14, 2013, 05:12:21 pm
Before you post any more code which is splatted all over the page, read this carefully: How to post code properly

You can post your code here if you like, but if you have been told not to do so by your prof/lecturer then you can be fairly sure that they keep an eye on this forum for posts like yours. Kinda obvious thing for them to do.

A few things for you to ponder though:
Code:
int i_redLedC = 7;    
int i_amberLedC = 6;
int i_greenLedC = 5;

int i_redLedD = 7;    
int i_amberLedD = 6;
int i_greenLedD = 5;

Doesn't something strike you as odd about these?

As His Grumpiness has pointed out, it takes about two minutes to go through the while loop once, so are you actually waiting 6 minutes for it to finish going round the loop three times? If you are, how do you know that it isn't getting out of that loop? Unless I've missed something after a cursory glance at the code, it looks to me like it has no choice but to finish after it's executed the while loop 3 times.

Unlike His Grumpiness, I'd say that for now your best bet is to get it working with delay() and then if you have any time left before this is due, try to figure out how to do this without delay() (hmmm - is there a pun in there?).

You really need to read up on the use of Serial.available() and also take into account that when you type something followed by Enter to the Serial monitor, it will send carriage return and/or linefeed as well.

Pete
386  Community / Exhibition / Gallery / Re: GPS logger on: November 14, 2013, 04:14:13 pm
If it is running on a battery, which it does when I'm driving and it's recording the track, there's no point trying to talk to the Serial port. I suppose it doesn't really matter - the bits won't go anywhere :-).
If I'm testing it at home, then I do want to see the failure message on the Serial monitor. Basically, it's a bit of old debugging.

Pete
387  Community / Exhibition / Gallery / Re: GPS logger on: November 14, 2013, 02:01:12 pm
I write a record every 5 seconds so there's plenty of time to open the file, seek to near the end, write the new stuff and close it again. Like this:
Code:
  SD_open_file();
  unsigned long filesize = myFile.fileSize();
  // back up the file pointer to just before the closing tags
  filesize -= 27;
  //Serial.println(filesize);
  if(!myFile.seekSet(filesize)) {
#ifndef BATTERY
    // Can't win 'em all. Print error message, but can't do anything
    // other than keep going and hope for the best!
    Serial.println("Seek failed");
#endif
  }
  // print the GPS data to the file
  myFile.print(trk_buf);
  // This will be overwritten by the next write to the file, if there is one,
  // and if there isn't, the file is complete and will read as a valid GPX
  myFile.print(F("</trkseg>\r\n</trk>\r\n</gpx>\r\n"));
  myFile.close();

Pete
388  Community / Exhibition / Gallery / Re: GPS logger on: November 14, 2013, 11:23:56 am
If you don't actually need the .CSV file itself, you could record the data directly to the SD card as a GPX file which can be read by Google Earth and Garmin software (amongst others). Saves having to translate the file but makes the file somewhat larger - but that's not usually an issue.

I made essentially the same kind of logger using an Adafruit Ultimate GPS, Teensy 3 (Correction: It's a Teensy 2) and the PJRC uSD card/adapter. It is nowhere near as good looking as your installation though :-)

Pete
389  Using Arduino / Programming Questions / Re: LCD Weird Characters on: November 12, 2013, 10:37:04 pm
I think you need to put lcd.clear() after the lcd.begin().

Pete
390  Using Arduino / Networking, Protocols, and Devices / Re: internet protocol causing problems ?? on: November 12, 2013, 01:44:17 pm
I don't know how the String library works but I presume that this code ...
Code:
void loop()
{
  String inChar;

... creates a new String on every entry to the loop() function even if the String is not used. Since loop() is executed thousands of times a second you might run into problems very quickly.
Even if it doesn't, use of String is a confounding issue. It would be best to remove it to either prove that it is or isn't the problem.

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