Show Posts
Pages: 1 ... 2248 2249 [2250] 2251 2252 ... 3234
33736  Using Arduino / Programming Questions / Re: convert 5v reading to 12v equivilant / analog input on: October 12, 2011, 04:56:39 am
val = val / 5;   //adjust to be more exact
Like dividing by 5.0, instead. Presuming val is a float and accuracy is desired.
33737  Using Arduino / Programming Questions / Re: reading push button at any time HELP on: October 12, 2011, 04:49:44 am
It would be nice to format your code before posting it, so that it is properly indented and readable. Posting code properly (using the # button) would be appreciated, too.
33738  Using Arduino / Programming Questions / Re: reading push button at any time HELP on: October 12, 2011, 04:48:17 am
as it will wrap around to 0 every few days.
Every 49+ days to be more accurate.
33739  Using Arduino / Programming Questions / Re: Serial IN ---> Ethernet OUT on: October 12, 2011, 04:42:51 am
    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.

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

          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.
33740  Using Arduino / Programming Questions / Re: RFID problem on: October 12, 2011, 04:35:59 am
Should I use the softwareserial?
No. SoftwareSerial is obsolete. Use NewSoftSerial, instead.
33741  Using Arduino / Networking, Protocols, and Devices / Re: Arduino not talking to pachube on: October 11, 2011, 03:04:11 pm
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:
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.
33742  Using Arduino / Programming Questions / Re: Serial IN ---> Ethernet OUT on: October 11, 2011, 02:28:07 pm
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, 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.
33743  Using Arduino / Programming Questions / Re: How do i read the frequency for a heart rate monitor? on: October 11, 2011, 02:20:47 pm
I believe it is because of my delay.
Yes. And the time it takes to write to the LCD.

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.

// 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

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

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?
33744  Using Arduino / Project Guidance / Re: Xbee with Arduino on: October 11, 2011, 11:37:01 am
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?
33745  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.
33746  Using Arduino / Programming Questions / Re: Interrupt Question on: October 11, 2011, 10:18:29 am
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.

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

Or does it go back to the start of the main loop?
33747  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.
33748  Using Arduino / Programming Questions / Re: IR Thermometer MLX90614 on: October 11, 2011, 09:11:32 am
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.

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?
33749  Using Arduino / Programming Questions / Re: Sweeping servo program question on: October 11, 2011, 09:05:55 am
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.
33750  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.
Pages: 1 ... 2248 2249 [2250] 2251 2252 ... 3234