Show Posts
Pages: 1 ... 1886 1887 [1888] 1889 1890 ... 3393
28306  Using Arduino / Storage / Re: Send file to microsd on Arduino UNO with Micro SD shield on: May 17, 2012, 08:10:34 am
When sending character data, the data should be typed as a char, and written using the print() method.

When sending binary data, the data should be typed as a byte, and written using the write() method.

Since the only thing that really knows ASCII vs. binary is you, because you can read one but not the other, typing the data as byte and using write() to write to the file will work for both cases, The only difference will be that when you open the files to read them, YOU (not the computer) will only be able to read one of them.
28307  Using Arduino / Programming Questions / Re: Remote vehicle ignition - code help. on: May 17, 2012, 07:54:33 am
If you ever get around to answering the question of how what that code does differs from what you want it to do, and post more code, please don't post code like that again.

    if (digitalRead(alternatorPin)==LOW)
is way too hard to read or modify.
    if (digitalRead(alternatorPin)==LOW)
is the same code with judicious white space, which is much easier to read (and see the logic of, at a glance).

There is nothing in that initial code that knows anything about "so the user gets to the car before the 15 minutes is up". If that is the problem, why not say so?
28308  Using Arduino / Programming Questions / Re: Enerlib with Arduino 1.0 on: May 17, 2012, 07:40:47 am
but this did the trick
That will work on a Windows system, where the OS thinks it is smarter than you. It will not work on a system that is smarter than Windows. (Which would be all the others.)

Refer back to Rob's post for why.

Hint: A != a.
28309  Using Arduino / Programming Questions / Re: Newb needs help with interrupts on: May 17, 2012, 07:31:08 am
As Coding Badly says, an interrupt is not needed.

An interrupt is something that occurs (not generally something that you make occur) that needs immediate attention.

In your code, a simple restructure, using millis() and a state machine, is all that is needed.
28310  Using Arduino / Programming Questions / Re: Check the status of a server script on: May 17, 2012, 07:25:07 am
On the arduino I am using the w5200 ethernet module, (exactly the same as the w5100)
No, it isn't. There are significant differences between the two chips.

Support for TCP is built into the W5100 and W5200 chips, though.
28311  Using Arduino / Programming Questions / Re: Fio Xbee communication on: May 17, 2012, 07:22:02 am
The indenting in your code is horrible. Use Tools + Auto Format to fix that. Then, post ALL of your code. We can't comment on the action of a function seeing only it's name.

Is this something due the way the buffer is filling up?
What buffers?

Certainly doesn't help.
28312  Using Arduino / Programming Questions / Re: Pinball "Shoot This" light + hit sensor on one pin? on: May 16, 2012, 02:34:47 pm
I'm wondering if I can put the LED and a normally-closed momentary button together on one pin. I'm fairly new to Arduino so I'm not certain as to the best way to do this. Would I set a pin to 'digital input', then run power from the 5v pin through an LED and the momentary button into the input pin?
If you set the pin as an input, and wire it the way you indicate, the LED will only come on when the switch is pressed. In which case the Arduino won't even know anything about the LED.

You can't simultaneously use a pin as input and output. One at a time, and the mode can be changed at any time. Just be careful how you wire things.
28313  Using Arduino / Project Guidance / Re: Need help in pan and tilt servo with roborealm.... on: May 16, 2012, 12:36:22 pm
I'm sorry. The pictures do not clarify anything. I can see if there is any separator between values, of how the value is actually send (ASCII or binary).
28314  Using Arduino / Project Guidance / Re: Need help in pan and tilt servo with roborealm.... on: May 16, 2012, 11:53:07 am
I sent it through "serial" in roborealm
I didn't think you were having roborealm wave a pair of servos with semaphore flags...

i sent both the distance from centre for x and y to arduino
The key is HOW? As text? If so, formatted how and separated how? Or, as binary? If so, how many bytes per value?
28315  Using Arduino / Project Guidance / Re: Reset Transistor: Soldering/Coding advice on: May 16, 2012, 11:50:18 am
Have you used this shield before?

Can you help with the problem I am asking about instead of picking apart every other aspect of the sketch?
I'm trying, but when I see what look to me like fundamental errors in the sketch, I can't seem to get past them. Sorry.
28316  Using Arduino / Programming Questions / Re: Can't upload programm on: May 16, 2012, 11:29:33 am
This code doesn't do anything with the motors. You need to put the Serial.begin() and Serial.print() stuff in the program that is supposed to run the motors.
28317  Using Arduino / Project Guidance / Re: Need help in pan and tilt servo with roborealm.... on: May 16, 2012, 11:09:31 am
if (Serial.available()){
    // Get the data coming through the serial port and store it in the buffer
    while (i < 4){
      incomingData =; // Assign the input value to the incomingData buffer
      i++; // Increment the counter
If there is one byte available to read, read all 4 of them. Don't you see that this is a problem? Changing 30 to 4 did nothing to solve the problem.

    distance = atoi(incomingData); // Convert ASCII to Int
incomingData is still not a NULL terminated character array, so it still can't be passed to atoi(). Changing 30 to 4 did nothing to address this issue.

in this case i need to sent both the COG_X and COG_Y to arduino to let it know the distance from centre for both x-axis and y-axis, but i felt that there is some thing missing in the code, as it seems like I am unable to specifically sent the x-axis data to the pan servo and the y-axis data to the tilt servo...the data just sent into both servo randomly....
This says nothing about HOW you are sending the data in roborealm. Until you tell us that, we can't help you.
28318  Using Arduino / Project Guidance / Re: Reset Transistor: Soldering/Coding advice on: May 16, 2012, 10:56:31 am
Found this on another forum topic. Do you think it will work for this project?

I'm going to try.

SoftwareSerial mySerial(2, 3);
You've got 4 hardware serial ports. Why are you using SoftwareSerial?
28319  Using Arduino / Project Guidance / Re: Need help in pan and tilt servo with roborealm.... on: May 16, 2012, 10:39:14 am
i changed the (i < 30) to (i < 4), i thought this is what adjust the speed T-T
What else did you change?

as for the the problem of the none accurate of either one axis is due to the incoming roborealm i sent both cog_x and cog_y to arduino so maybe it cant differentiate data of which is for pan and which is for tilt...any help ??
How? If you send two angles, 121 and 40, the serial stream would look like '1', '2', '1', '4', '0', unless you used some kind of separator. How is the Arduino supposed to decide if that is 12 and 140 or 121 and 40 or 1214 and 0 or 1 and 2140?

Telling half the story doesn't get you much help. We need the whole story.

as for the servo, is powered by connecting to the arduino 5v output...
Well, that's why your servo doesn't move very fast, then. It is severely underpowered. You need a separate power supply for the servo, matching the voltage expected by the servo, and capable of delivering the current that the servo needs.
28320  Using Arduino / Programming Questions / Re: help me improve my mux function? on: May 16, 2012, 10:31:32 am
There is no reason to have a for loop if you are going to have separate code for each iteration of the loop. That's just plain silly.

An array of values for the three pins, and an array for lastswi values would eliminate the need for different cases for each iteration.

Pages: 1 ... 1886 1887 [1888] 1889 1890 ... 3393