Show Posts
Pages: 1 ... 2249 2250 [2251] 2252 2253 ... 3235
33751  Using Arduino / Programming Questions / Re: reading push button at any time HELP on: October 12, 2011, 04:48:17 am
Quote
as it will wrap around to 0 every few days.
Every 49+ days to be more accurate.
33752  Using Arduino / Programming Questions / Re: Serial IN ---> Ethernet OUT on: October 12, 2011, 04:42:51 am
Code:
    if ((check > 46) && (check < 123) || (check == 42)) {   // only 'good' characters, otherwise Ethershield won't send it/hangs
No clue what the significance of these magic numbers is.

Code:
    if ((check >= '/') && (check <= 'z') || (check == '*'))
makes a lot more sense to me.

Code:
          delay(2000UL);                   // delay 60s
If you are going to have useless comments, at least they should be right.

The random indenting does not make for readable code. Putting each { on a new line, deleting unnecessary blank lines, and using Tools + Autoformat would make for much more readable code.
33753  Using Arduino / Programming Questions / Re: RFID problem on: October 12, 2011, 04:35:59 am
Quote
Should I use the softwareserial?
No. SoftwareSerial is obsolete. Use NewSoftSerial, instead.
33754  Using Arduino / Networking, Protocols, and Devices / Re: Arduino not talking to pachube on: October 11, 2011, 03:04:11 pm
Quote
it looks like it should calculate the length or does it need to be inserted manually?
Well, you're right. It looks like that code is supposed to do that. It's interesting, though, that the error message you posted shows the content type is text/html, when the code defines the content type as text/csv. That leads me to believe that the whole package being sent is not being received.

I wonder if this:
Code:
client.print("MY PACHUBE KEY");
needs to be
client.println("MY PACHUBE KEY");

Could be that a missing carriage return/line feed is causing issues.
33755  Using Arduino / Programming Questions / Re: Serial IN ---> Ethernet OUT on: October 11, 2011, 02:28:07 pm
Quote
Can I make something that sends ONLY 0..9 and a..z to my Ethershield
You can, but I think that that is not the best solution. I find it hard to believe that the ethernet library causes the ethernet shield to lock up when you send a period.

But, you are collecting data, using Serial.read(), and sending it using client.print() (presumably, need to see your code). Call a function prior to the client.print() call to remove "invalid" characters from the string. There are a number of str* functions that might be of interest - strcspn comes to mind.
33756  Using Arduino / Programming Questions / Re: How do i read the frequency for a heart rate monitor? on: October 11, 2011, 02:20:47 pm
Quote
I believe it is because of my delay.
Yes. And the time it takes to write to the LCD.

Quote
How do I rid of the delay but still get the screen not to update as much?
I'd tell you to look at the blink without delay example, but you've been there/done that, but apparently it didn't take.

Code:
// Add as global
unsigned long lastUpdate = 0;
unsigned long updateInterval = 500;

// Put in loop
if(millis() - lastUpdate > updateInterval)
{
   // Put your LCD code here, except
   // lcd.begin() which belongs in setup
   // and get rid of the delay() call
}

Quote
I know it's because I have lcd.begin outside of the setup, but that allows it to erase characters that don't update.
Code:
 lcd.print(bpm);
  lcd.print("   "); // Wipe out trailing characters...

Quote
For instance if my heart rate is first 66 and then the next time it computes it to be 0, it will display 06 instead of 0.
If it computes 0, your in cardiac arrest. Is the display important then?
33757  Using Arduino / Project Guidance / Re: Xbee with Arduino on: October 11, 2011, 11:37:01 am
Quote
to upload the code and make it work is what is needed.
What problems are you having? Are you trying to upload the code using the XBees?
33758  Using Arduino / Programming Questions / Re: Sweeping servo program question on: October 11, 2011, 10:26:17 am
If actual position information is essential, a real rotary encoder would be better than hacking a servo. Much higher resolution and repeatability.

I don't understand why the actual angle is critical. If the computer is tracking something, and it appears to be moving to the left, it should be telling the servo to move to the right. If the object appears to be moving while the servo isn't, it is either because the servo is drifting (unlikely), the object being tracked is moving (likely), or because the servo is drifting. In any event, the simplest solution is simply for the PC to tell the Arduino three values, instead - which servo, which direction, and how far ('P' '+' 2), and have the Arduino figure out which angle to send the servo to. If the new position isn't right, the PC will send a new increment.

It doesn't matter which way the servo is actually pointing. It's either pointing where the computer wants or it isn't. The PC can issue corrections until the Arduino gets it right.
33759  Using Arduino / Programming Questions / Re: Interrupt Question on: October 11, 2011, 10:18:29 am
Quote
After I call an interrupt, where does the code go from there?
You don't call an interrupt. An event occurs that triggers an interrupt - either internal, such as a timer ticking, or external, like serial data arriving.

Quote
Does it go back to the point in the code where the interrupt was called?
Yes.

Quote
Or does it go back to the start of the main loop?
No.
33760  Using Arduino / Project Guidance / Re: Solar Tracker + Servo Consumption + battery charger on: October 11, 2011, 09:27:54 am
Servos are much more dependent on current than voltage. The 4 AAs provide lower voltage, but a lot (read that as a whole lot) more current. Servos are generally tolerant of low voltage, but are not at all forgiving of low current.
33761  Using Arduino / Programming Questions / Re: IR Thermometer MLX90614 on: October 11, 2011, 09:11:32 am
Quote
Do you have any idea what could be the possible reaon for this?
Could be a number of things. Could be that the sensor is not connected correctly. Could be that the sensors address is not what the code says it is. Could be the sensor is defective.

Quote
To complicate things even more, the i2cmaster wont run on the Arduino out of the box, some files need to be renamed and changed, and an extra txt file is needed to get it working. But… because it is open-sourced I can make those changes, and redistribute it. So that’s what I’m going to do, I’m just giving it to you here in its working version to save you some time and headache. You will need to drop the library into your Arduino library folder for it to work, but we will get there.
Did you do all of this?
33762  Using Arduino / Programming Questions / Re: Sweeping servo program question on: October 11, 2011, 09:05:55 am
Quote
I could write the programmer code to write the actual rotation angle needed but I would need some feedback of the current servo location.
If the PC is totally in charge of servo position, then, no, you don't need any feedback. Not that you'd get any, anyway, since if you try to read a servo's location, the value you get back is the last value you told it to go to, regardless of whether it was able to get there, or not.
33763  Using Arduino / Project Guidance / Re: Passing int array to loop() from setup() on: October 11, 2011, 08:59:01 am
If you truly want to create a variable sized array, you'll need to look at using malloc. The pointer to the (pointers to the) space that you allocate must still be global. The Arduino has a limited amount of memory, so dynamic memory allocation is generally to be avoided.

Creating a static array large enough for your most ambitious use is better, as long as that array fits in memory, with enough room left to run the rest of your program.
33764  Using Arduino / Project Guidance / Re: Which Arduino for USB? on: October 11, 2011, 08:36:20 am
Quote
suspected as much!
Probably wasn't using a cell phone GPS, either.
33765  Using Arduino / Project Guidance / Re: Passing int array to loop() from setup() on: October 11, 2011, 08:34:08 am
Quote
My question to you is how do you pass an array from a function to the other?
Passing a function to an array is not the difficult part. The setup() function does not call loop(), though, so you can not make setup() pass an array to loop().

You can define the array globally (before setup()), so that both functions have access to the same array. Initialize it in setup(), and use it in loop().
Pages: 1 ... 2249 2250 [2251] 2252 2253 ... 3235