Show Posts
Pages: 1 ... 2318 2319 [2320] 2321 2322 ... 3289
34786  Using Arduino / Interfacing w/ Software on the Computer / Re: Processing reading serial affecting servo control? on: October 07, 2011, 12:01:03 pm
Quote
Yes I am, is this problem?
Most likely. The source of power when the USB cable is connected is not the same source of power as when the USB cable is not connected.

The current required to move the servo may be marginally safe when the Arduino is powered by batteries/wall-wart, or it may not.

The current required to move the servo simply may not be available when the Arduino is USB powered.

In any case, running all the current that the servo needs through the Arduino is not a good idea.

The servo should be powered independently of the Arduino (with the grounds connected), and simply commanded by the Arduino.

Code:
const int tagLength = 13; //  13 = 0-12
I think your math is wrong. 0 minus 12 is -12, not 13. smiley
34787  Using Arduino / Programming Questions / Re: Trouble with Tweet Lib on: October 07, 2011, 11:48:19 am
This topic always amazes me.

Quote
I have been working on an environmental monitoring system for my company's server room.
So, why can't you use one of your own servers, with access restrictions that YOU control, instead of Twit?

34788  Using Arduino / Programming Questions / Re: relay activation on: October 07, 2011, 11:45:51 am
Quote
fast and dirty do a
delay (1000);
Even better, of course, is to use millis() to record when you turned the relay on, and ignore any requests to turn the relay on again unless the time between the new request and the old (successful) request is greater than the threshold. Look at the blink without delay example.

For why, suppose that the time was 1 hour, instead of 1 second, and the Arduino was displaying the time, too.

Using millis(), the Arduino would continue to display the time. Using delay() it would not.
34789  Using Arduino / Programming Questions / Re: PIR Sensor problem on: October 07, 2011, 11:39:01 am
« on: October 06, 2011, 06:42:54 PM »
« Reply #1 on: October 06, 2011, 06:54:21 PM »
Less than 12 minutes before bumping? Get a life.

34790  Using Arduino / Programming Questions / Re: Web Client and ThingSpeak Client - possible? on: October 07, 2011, 11:36:07 am
Quote
(if they get some half decent programming in them!)
So true.
34791  Using Arduino / Programming Questions / Re: why don't 'while' work? on: October 07, 2011, 11:34:05 am
Code:
  }   

  while (time < sampletime);
The while clause generally goes next to the closing brace of the do statement, to distinguish it from a while statement.

If you want to do something for a fixed time every time the Arduino is reset, you should put that code in setup(), and leave loop() empty.
34792  Using Arduino / Programming Questions / Re: counter function in Arduino on: October 07, 2011, 11:19:01 am
Any variable can be used as a counter. Increment the value when the pulse occurs.
34793  Using Arduino / Programming Questions / Re: Arduino-> Xbee -> Xbee->Arduino where is my data ? on: October 07, 2011, 11:12:44 am
Quote
Anyone who can tell me what did I do wrong ?
You didn't tell us what kind of XBees they are.
You didn't tell us how they are configured.
You didn't post any code.

Aside from that, nothing obvious.
34794  Using Arduino / Programming Questions / Re: Detect data value changes on: October 07, 2011, 11:09:13 am
Quote
The statement does run every 10 minutes
That's a bit surprising, since the 600000 literal will be interpreted by the compiler as an int. The value will not fit in an int, so overflow will occur. 600000UL would be interpreted as an unsigned long with better results.
34795  Using Arduino / Programming Questions / Re: removing leading zero from an LCD on: October 07, 2011, 10:53:59 am
This is the code that converts the int to a string:
Code:
itoa(tmpred_value, red_value, 10);
It does an UNFORMATTED conversion.

Code:
sprintf(red_value, "%3d  ", tmpred_value);
would do the same thing, except as a FORMATTED conversion.

The part in the quotes is a format specifier. The % defines where a format specifier starts (where a variable's value will be substituted). The d says that the value is an int. The 3 says that we want the resulting value to have a minimum of 3 characters, with leading spaces as required ("  3", " 30",  "255", "1023"). The two spaces on the end are copied as-is to the output. So, you will get 5 characters (plus a trailing NULL) in the output - at a minimum.

You can remove the trailing spaces, if you want. They simply ensure that the string is long enough to cover the previous data, in case you are not using a fixed space font.
34796  Using Arduino / Programming Questions / Re: input variables - communicate with arduino through PC on: October 07, 2011, 10:46:31 am
Quote
I was thinking today of making a program for the arduino where I could input variables from my PC and run them through the program and send back the results as a pulse width or other results.
What is the PC going to do with a pulse width? What do you mean by a pulse width? Pulse width is generally a measure of how long an incoming pulse was HIGH, or the time between pulse HIGH to LOW to HIGH again.

Quote
I know this would have to be done through the serial interface, right?
Communication between the PC and the Arduino is via the serial port, yes.

Quote
I have already input variables through a keypad, etc. so I am guessing its just a matter of getting the pc to speak the correct language I need to the arduino.
I was thinking of using hyperterminal - is this the right track?
No need to guess. But, it was a reasonable conclusion to leap to. Hyperterminal is how YOU, not the PC, communicate with the serial port.

Quote
Anyone know where i should start, or how i could get the computer to input even one variable to the arduino?
The computer won't be inputting variables to the Arduino. It will be sending values to the Arduino. Big difference. The playground has a section on communicating with the Arduino, using lots of different programming languages. Personally, I think C# makes the process the easiest. YMMV.

Quote
Would it be better to use a ethernet shield or just stick with serial?
Get the communications part working using serial, first. Then, if you want, you can replace the application on the PC with a web interface, and have the Arduino with ethernet shield serve up/respond to a web page.

Quote
Is it going to be a handshake type of operation?
That's up to you.

Quote
There are some tutorials on serial comm with a PC, but I havent seen one yet where you input the variable from your PC. And most of the tutorials are a bit vague.
Tutorials are guides - not hand-holding.

Quote
I am wondering if this is even possible, and if i am getting over my head before I get started?
Yes it is, and that depends on your programming skills, understanding of communications between processes/computers, and commitment. I'd have it done in a couple of hours. You might, too, or you might take two weeks. We're here to help.

Quote
Even if you tell me im stupid for trying to do this.....<VBG>
Stupid would be throwing up your hands and not even starting.
34797  Using Arduino / Programming Questions / Re: GLCD Bar Graph on: October 07, 2011, 10:34:59 am
Quote
Ill be using the bar graph to display the reception of the sm5100b sms module.
As I recall, an sm4100b sms module receives text messages sent from a cell phone. You want to display the text message as a bar graph?

Some information on what GLCD (and library) you have would be useful.

Most GLCDs have some mechanism for drawing filled or empty rectangles. You want to draw two rectangles - one filled, one empty. The size/placement of the upper, left corner of the pair, and the lower, right corner of the pair is fixed. The other two corners depend on ? (how many messages, how much text in the message, how long ago the message was sent, something else entirely).
34798  Using Arduino / Programming Questions / Re: removing leading zero from an LCD on: October 07, 2011, 10:30:25 am
Quote
Inserting spaces did not fix my problem. Like most of my programming it now works by accident. I have no idea yet why it this works, but it does:
If you showed us the code that converts tmpred_value (an int) to red_value (a string), we could show you how to ensure that red_value was always the same length, and had the leading or trailing spaces like you want, in one step, instead of half a dozen steps.
34799  Using Arduino / Programming Questions / Re: trigonométrie laser on: October 07, 2011, 10:26:51 am
This section of the forum is for programming questions. You didn't ask one. This post belongs in Project Guidance.
34800  Using Arduino / Project Guidance / Re: Reset when receives an IR command on: October 06, 2011, 03:50:59 pm
Quote
P.S: For more information I can post my code if you want.
Only if you really want help.
Pages: 1 ... 2318 2319 [2320] 2321 2322 ... 3289