Show Posts
Pages: 1 ... 18 19 [20] 21 22 ... 67
286  Using Arduino / Interfacing w/ Software on the Computer / Re: A fatal error with Arduino and Python on: April 10, 2013, 08:49:37 am
Quote
Basically saying keep checking ser until you find a '0', do not progress with the script until Arduino has finished it's function.
Quote
I understood your intent, and was pointing out that this code does not do quite that because it has a bug.  It only checks every other character, and throws away the other half without looking at them:
Code:
while ser.read() == '0':   // if the next serial input char is not '0'
    ser.read()                  // read and discard the following char
[code]


-br
[/code]
287  Using Arduino / Interfacing w/ Software on the Computer / Re: A fatal error with Arduino and Python on: April 10, 2013, 07:31:35 am
Concur with Paul, and found another similar issue:

Code:
    #loop until the arduino is connected
    while not connected:
        serin = ser.read()
        connected = True
 

The "connected = True" inside the loop guarantees it will run only once.  But anyway, how does this code in any way wait until the arduino is connected?

When you open the serial port, the Arduino resets and hangs out in the bootloader for a couple seconds to see if you want to upload new code.  During that time, your program is not running.  Try adding time.sleep(2) after opening the serial port to allow the bootloader to time out and start your arduino code before proceeding with your python stuff.

-br
288  Using Arduino / Project Guidance / Re: Combining code to make a new Program on: April 09, 2013, 07:53:52 am
Combining two things you don't understand into a bigger thing you don't understand usually leads to poor results, as you and Dr. Frankenstein have both discovered.

You stated you had the audio part working competently.  Do you have the IR stuff working in a testbed of its own?  If not, you might find that you understand it well enough after getting it working on its own to figure out how to integrate it into the audio sketch.

In other words, get a firm understanding of the pieces and you'll be better positioned to merge the parts you want.  Most people who have trouble at the stage you are in are stuck in denial about needing to understand the code.

-br


289  Using Arduino / Project Guidance / Re: Can't mix 2 Arduino sketches (RFID + WEB SERVER) on: April 09, 2013, 07:46:08 am
Terry: 

Great effort.  Thanks for doing it.

May I offer a friendly amendment?  There is a missing Step 0 which usually turns out to be actual the root cause of problems new coders have combining sketches:

0. Start by understanding both sketches and the resources and libraries they use before attempting to stitch them together.  If there is any part of either sketch you don't understand, that will be the part that causes you trouble.

This might be called Dr. Frankenstein's Law...


Cheers,

-br
290  Using Arduino / Programming Questions / Re: Reading the Arduino SD Card on: April 09, 2013, 07:34:32 am
For real code, there's the DumpFile example that ships with the IDE:

File -> Examples -> SD -> DumpFile

You also need a program on the PC side to catch the data and store it in a file, as has been mentioned.  Easily found with a forum search.


-br

291  Using Arduino / Storage / Re: How to determine current working directory on: April 09, 2013, 07:31:04 am
Read up on the strcmp() function.

-br
292  Using Arduino / Networking, Protocols, and Devices / Re: Heroku Request on: April 07, 2013, 09:54:10 am
Did you consider trying the Heroku application hostname you are attempting to connect to?

-br
293  Using Arduino / Networking, Protocols, and Devices / Re: Heroku Request on: April 07, 2013, 09:36:45 am
1. That was an example from the link I provided.  It is necessary to adapt it to your code.

2. You need a Host: header.  Did you try that?


-br
294  Using Arduino / Networking, Protocols, and Devices / Re: Heroku Request on: April 07, 2013, 09:19:58 am
It is necessary to send a Host header so Heroku knows which app to route your request to:

From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html:
Code:
       GET /pub/WWW/ HTTP/1.1
       Host: www.w3.org

-br
295  Using Arduino / Programming Questions / Re: Order of operations on: April 06, 2013, 04:34:17 pm
http://en.wikipedia.org/wiki/Order_of_operations

-br
296  Using Arduino / Programming Questions / Re: VirtualWire receiver breaks other code on: April 06, 2013, 03:13:09 pm
I would be a little concerned about the amount of free memory, especially since your receive buffer is on the stack.  Search the forum for "free memory function" and you'll find some code that will tell you how much RAM is free.  If it's less than 200 you might be seeing a stack overflow.

I also wonder whether setting the rx_pin before calling vw_setup might help:

Code:
 // instead of this:
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000);// Bits per sec
  vw_set_rx_pin(receivePin);
  vw_rx_start();// Start the receiver PLL running

Code:
 // is this any better:
  vw_set_rx_pin(receivePin);
  vw_setup(2000);// Bits per sec
  vw_rx_start();// Start the receiver PLL running

Edit: Also, unless you have a devious plan that requires using int values instead of char or byte, you could save 100 bytes of RAM right away by switching to char if the values in this array will never exceed 255:
Code:
int scrollingLetterKeys[maxScrollingLetterKeys];

-br
297  International / Deutsch / Re: Bug in Funktion "Serial.println" ???????????? on: April 06, 2013, 07:15:47 am
Please pardon my English.  There is a well-known bootloader bug with using "!!!" with certain early versions of the Mega. 

Remove the "!!!" and the problem may go away.

Kind regards,

-br
298  Using Arduino / Project Guidance / Re: Triggering a Smoke Detector as an alarm on: April 01, 2013, 06:51:29 am
Your LED might glow brighter if you set the pin to be an OUTPUT:

Code:
void setup(void) {
  pinMode(12, OUTPUT);
  Serial.begin(9600);
}

-br
299  Using Arduino / Programming Questions / Re: Help converting serial commands to a usefull string. on: March 31, 2013, 08:49:49 pm
The first Serial1.available() properly guards the first Serial1.read().  But the code falls through and reads another character without ever checking Serial1.available() again.  If there was only one character available initially, you will be trying to read a second one before a second character is available.

The symptom when this happens is that Serial1.read() returns -1, which, when you print it, shows up as the y-umlaut character in your example output text.

-br
300  Using Arduino / Programming Questions / Re: Help converting serial commands to a usefull string. on: March 31, 2013, 08:28:24 pm
Code:
    if(incomming = true){
      if(index < 19) // One less than the size of the array
      {
        inChar = Serial1.read(); // Read a character

This code reads from Serial1 without checking Serial1.available() to see if any characters have arrived yet.  When you do that, Serial1.read() returns -1, which is why you see those y-umlaut characters.

Also, if it wouldn't be too much trouble, would you mind spelling "incoming" with the usual number of 'm's?

-br


Pages: 1 ... 18 19 [20] 21 22 ... 67