Show Posts
Pages: 1 ... 28 29 [30] 31 32 ... 97
436  Using Arduino / Motors, Mechanics, and Power / Re: 25A Solid State Relays Keep Failing on: July 19, 2013, 04:39:41 pm
I don't see the point of this code:
Code:
    for(i = 0; i<fanDuration; i++){
      digitalWrite(fanPin, HIGH);
      digitalWrite(ledPin, HIGH);
      delay(1);
    }

As far as I can see, it is equivalent to:
Code:
    digitalWrite(fanPin, HIGH);
    digitalWrite(ledPin, HIGH);
    delay(15000);
   

Pete
437  Using Arduino / Networking, Protocols, and Devices / Re: GPS can't read on: July 19, 2013, 12:05:21 pm
Apart from the use of goto, which will be mightily frowned upon by the cognoscenti, this code is going to give you lots of grief:
Code:
 if(Serial.available()>0)
  {
    for(i=0;i<20;i++)
    {
    value[i] = Serial.read();

Serial.available()>0 only guarantees you that there is at least ONE character in the buffer. But you read 20 of them.

You may also be having problems with the amount of free static ram - a Uno or Nano only has 2kB of static ram. You have quite a few float variables (and, on Arduino, double is the same as float) which take up a fair bit of room, as does the SD library which needs 512 bytes for a buffer.


Pete
438  Using Arduino / Interfacing w/ Software on the Computer / Re: Duemilanove to Desktop Computer Serial Port Direct Connection on: July 19, 2013, 10:39:32 am
The onboard serial connection almost certainly uses standard RS-232 signalling where the voltages are plus and minus 12V. The voltages might be less than that e.g. +/- 10V but they are not compatible with direct connection to the Arduino and you will be very lucky if you have not already blown the Arduino's two serial port pins or even the whole chip. RS232 signals are also the logical inverse of what the Arduino uses, which is TTL levels of zero and five volts.
You must use some sort of conversion between the voltage levels. This can be as simple as a pair of transistors (with resistors) or a MAX-232 (or similar) chip.

Pete
439  Using Arduino / Programming Questions / Re: I don't understand the error message please help on: July 18, 2013, 04:17:12 pm
and here?
Code:
      }else(i = 1);

Pete
440  Using Arduino / Audio / Re: DTMF decoder library on: July 17, 2013, 02:05:15 pm
Which other libraries, what do they do?

Pete
441  Using Arduino / Storage / Re: Can't do subsequent reads from SD card on: July 17, 2013, 10:05:28 am
When you run over the end of the array, it might be clobbering the filename so that instead of being "killog.txt", it is "\nillog.txt" or something similar. That kind of thing is hard to predict unless you get the assembler output so that you can see which variable has been allocated space after the kwh array. Even then, the linker might change things around.

Pete
442  Using Arduino / Storage / Re: Can't do subsequent reads from SD card on: July 16, 2013, 05:28:46 pm
Can you look at that file with a hex editor? I suspect that it isn't  "5.0\r" but perhaps "5.0\n\r" so that you write over the end of the kwh array.

Pete
443  Using Arduino / Programming Questions / Re: Serial communications question on: July 16, 2013, 05:20:32 pm
AAAAaahhhhhhhh. Thanks for the enlightenment!

Pete
444  Using Arduino / Programming Questions / Re: Serial communications question on: July 16, 2013, 04:14:11 pm
Why not open the Arduino IDE, go to File|Examples|Digital|Button, load that example and read it very carefully.
And/or you could read this: http://www.arduino.cc/en/Tutorial/Button

Pete
P.S. What does your question have to do with serial communications?
445  Using Arduino / Audio / Re: MIDI Messages - Affecting a note once NoteON has been sent. on: July 15, 2013, 11:08:11 am
My experience with MIDI, such as it is, has only been with keyboards/synth, but I would guess that there's something about breath controllers which will trigger the equivalent of a note on since the note should start sounding when you blow rather than there being an obvious switch closure as there is with a keyboard.
If you have access to a breath-controlled device, it would be easy to write/find a midi-monitor sketch which would allow you to see precisely what it generates.

Pete
446  Using Arduino / Audio / Re: MIDI Messages - Affecting a note once NoteON has been sent. on: July 15, 2013, 10:11:36 am
There is a specific MIDI message for aftertouch/pressure.
See http://www.midi.org/techspecs/midimessages.php
If that message doesn't work for breath control, I'm sure there's a midi message that will handle it.

Pete
447  Using Arduino / Programming Questions / Re: Quick question on: July 15, 2013, 10:05:28 am
Read, and act upon, this: How to post code properly


Pete
448  Using Arduino / Programming Questions / Re: Extracting numbers, to put in 3 array, from a string (Computer side code added) on: July 12, 2013, 09:54:18 pm
Code:
  // Read serial input:
  if (Serial.available() > 0) {
    inChar = Serial.read();
  }

That reads a character if one is available and then proceeds even if one is *not* available!

Try replacing it with this:
Code:
  // Read serial input:
  while(Serial.available() < 1);
  inChar = Serial.read();
 

You will also run into problems eventually because it is a bad idea to use the String class.
But give my fix a try first and let's see if the code parses the string properly.

Pete
449  Using Arduino / Programming Questions / Re: Extracting number from a string (Computer side code added) on: July 12, 2013, 09:25:12 pm
Read this: How to post code properly

Pete
450  Using Arduino / Programming Questions / Re: Reverse Geocache Box coding problem on: July 11, 2013, 10:24:32 pm
Code:
  if (mySerial.available() > 0)
  {
    Serial.write(mySerial.read());                         // send raw GPS data to serial monitor
   
    if (tinygps.encode(mySerial.read()))

You read two consecutive characters from mySerial but "mySerial.available() > 0" only guarantees you that there is at least one. I think what you may have intended here was something like this:
Code:
    char c = mySerial.read();
    Serial.write(c);
    if (tinygps.encode(c))


Pete

Pages: 1 ... 28 29 [30] 31 32 ... 97