Show Posts
Pages: 1 [2] 3 4 ... 3270
16  Using Arduino / Networking, Protocols, and Devices / Re: Xbee to Arduino Serial Response on: August 21, 2014, 10:18:49 am
My code had no expectation that you were going to add Serial.print() statements in loop() to send "URL" info again.

If you are going to do that, you need to make some changes:
Code:
      else
      {
         Serial.print("The value is: ");
         Serial.println(atoi(stuff));

          index = 0;
          stuff[index] = '\0';
      }
17  Using Arduino / Networking, Protocols, and Devices / Re: Serial1 - Atmega2560 on: August 21, 2014, 10:16:38 am
Quote
I was thinking about the order that the references were created in the bootloader.
The bootloader knows nothing about the code that the chip is trying to run. There are no "references" in the bootloader.
18  Using Arduino / Programming Questions / Re: millis inside while on: August 21, 2014, 09:51:18 am
Code:
   if(val > 50)
              {
                //digitalWrite(led, HIGH);

                     // here if the switch is pressed
                 startTime = millis();
                       while(val > 50);
If val is greater than 50, record the current time. Then, start an infinite loop.

Check back with us when that loop finally finishes.
19  Using Arduino / Networking, Protocols, and Devices / Re: Xbee to Arduino Serial Response on: August 21, 2014, 09:11:45 am
Quote
I added the "@" after the numbers on the page so now I get the following
Great. So, now add:

Code:
char stuff[10];
byte index = 0;
before setup(), and make loop look like:

Code:
void loop()
{
   if(Serial.available() > 0)
   {
      char c = Serial.read();
      if(c != '@')
      {
         if(index < 9)
         {
            stuff[index++] = c;
            stuff[index] = '\0';
         }
      }
      else
      {
         Serial.print("The value is: ");
         Serial.println(atoi(stuff));
      }
   }
}
20  Using Arduino / Programming Questions / Re: xyz.h vs xyz.cpp files - how are they related? on: August 21, 2014, 09:05:29 am
Quote
How are stepper.h and stepper.cpp related?
The header file, stepper.h, defines a class. The source file, stepper.cpp, implements the class.

When you include a .h file, you are telling the IDE that it needs to compile the corresponding .cpp file, too.

There is, of course, no reason to include a header file unless you intend to create an instance of the class that it defines.
21  Using Arduino / Programming Questions / Re: flasing led + flickering. on: August 21, 2014, 09:00:48 am
Quote
2) What can i do to flash the middle small dot 2 times per second. If i try using millis() function eventually flashing led and minutes will be out of phase.
Not if you do it right.

The delay() in setHour() is wrong. Look at the state change detection example to see how how to deal with when the switch becomes pressed, rather than is pressed.
22  Using Arduino / Project Guidance / Re: Yet Another Motoduino! Gearhead plays with soldering gun. on: August 21, 2014, 08:47:08 am
Quote
So far the shopping list is
You forgot the whiskey, you idiot!  smiley-cool

Quote
GPS logging is not a must
I'd just add a commercial GPS which already does the logging and speed calculations and shows maps, etc.

How does the current mangled speedometer get data? Is it mechanical? My Harleys haven't used mechanical means since the 90's.
23  Using Arduino / Project Guidance / Re: Reading a current transformer on: August 21, 2014, 08:33:39 am
Quote
50 HP are too many HP: be careful.
There's no such thing as too much horsepower.  smiley-cool

The advice is sound, though.
24  Using Arduino / Project Guidance / Re: Detect beeping sound on: August 21, 2014, 08:27:37 am
Quote
Possible to do so?
Give it a try. You've got nothing to lose.
25  Using Arduino / Project Guidance / Re: Motion Sensor ->ATTiny-> RFTransmitter -> XBee->Arduino WiFi on: August 21, 2014, 08:23:27 am
Quote
Are there holes in my logic? Fundamental misunderstandings of the technology?
Could be. If the Arduino with WiFi shield is going to be using an XBee to receive data, the other devices must also be using XBees to transmit data.

If they are, then they have microprocessors built in, and the ATTiny at the transmitter nodes contributes nothing.

Other than that, the rest of the scenario is plausible. Personally, though, I'd skip the Arduinos altogether. An XBee with motion sensor at each node and a XBee and USB Explorer connected to a PC. Run an application on the PC that gets data from the XBee, and stores it locally or in a database (local or remote) if that's more convenient.
26  Using Arduino / Networking, Protocols, and Devices / Re: Serial1 - Atmega2560 on: August 21, 2014, 08:07:30 am
Quote
When I turn off the circuit and turn on, it no longer works, it confuses Serial1 with a SoftwareSerial
Not possible. The hex file that was uploaded shouldn't know anything about SoftwareSerial, so it can't possibly be confusing an instance of HardwareSerial for an instance of SoftwareSerial.

There seems to be something wrong with YOUR hardware setup.

I suggest that you try the code on a real Mega.
27  Using Arduino / Networking, Protocols, and Devices / Re: Xbee to Arduino Serial Response on: August 21, 2014, 08:05:00 am
One of the issues that I can see is that you are using the hardware serial pins to talk to the Serial Monitor AND to talk to the python application. I can see that one or the other is going to get confused.

I'm a bit surprised that there is nothing after the 2 digit response.

ThatsnotaverygoodideaforobviousreasonsDoyouhaveanycontroloverwhatreturnstheresponse
28  Using Arduino / Project Guidance / Re: multi port reading on: August 21, 2014, 07:38:43 am
Quote
Is it possible to gather datas from both device(xbee shield and gps module) in one sketch and one arduino?
Yes, it is.

Quote
Which way can you tell or suggest?
I suggest that you share the code you currently have, and describe what it isn't doing that you want it to do, and/or what it is doing that you don't want it to do.
29  Using Arduino / Programming Questions / Re: Can't make button increment my Array :( on: August 21, 2014, 07:32:16 am
Quote
Does that mean if I store char strings in an array I need to make sure the array hase one more char then I actually plan to use for each slot?
Yes.

Quote
Would I write char(17) arrayName(4) or can I get away with char arrayName(4) ?
No and no.

When the type is char *, the values are NULL terminated strings, and the compiler takes care to allocate enough space for each string. And, you use [4], not (4), to define an array with 4 elements.

When you are defining an array that you are going to put data in later, that is when you need to be careful to size the array correctly.

Removing one space was not the correct solution. You are writing 16 characters, plus a NULL, into the array so that when you print the array on the LCD, the whole line gets blanked. In order to do that, you need to make the array able to hold 17 characters.
30  Using Arduino / Programming Questions / Re: Can't make button increment my Array :( on: August 21, 2014, 06:29:51 am
Quote
Sorry I don't know enough to understand what you mean.
Here:
Code:
char value[16];
you define an array that can hold 16 characters.

Here:
Code:
  sprintf(value, "      %1d         ", number);
you write 17 characters into it - 6 spaces, 1 digit, 9 spaces AND the terminating NULL.
Pages: 1 [2] 3 4 ... 3270