Show Posts
Pages: 1 2 [3] 4 5 ... 18
31  Using Arduino / Programming Questions / Re: Please modify this code on: July 09, 2012, 03:33:20 pm
a small extra note
if you want a function to go from a string to number it goes like this

Code:
 
int ConvertStringToInt(string S)
 {
   return int(s);
 }


A small typo here (capital S swapped place), but what is the point of this? Assuming that the String class implements cast to int (haven't use it, but as your code indicates), why bother writing  a function (and justify the extra run time overhead)  when  it does nothing but the cast.


As mentioned earlier there is always one answer to a function so you could repeat it
If you have this function you can write

Code:
A = ConvertString(lux_v1);
B = ConvertString(lux_v2);
in this case its more typing work, but often functions are good to repeat complex computer math programming, so using functions is a good thing just to let you know  smiley-grin


Wouldn't this be better?
Code:
A = int(lux_v1);
B = int(lux_v2);

32  Using Arduino / Networking, Protocols, and Devices / Re: GET - http request not working? on: July 09, 2012, 01:01:48 pm
How have you verified that the request is being cut? Did you check the server logs or did you use a network monitor/sniffer?

Anyway,  GET request you are trying to send looks invalid. Check this thread: http://arduino.cc/forum/index.php/topic,113010.msg851718.html#msg851718

Especially the post where I explain how you can test the request using telnet.  Testing with a browser is not the same thing.
33  Using Arduino / Project Guidance / Re: Importing code from Arduino board to pc on: July 07, 2012, 03:03:40 pm
No, you can't import the source code from the Arduino. You can import the binary (the hex file) but it wont probably help you a lot.
34  Using Arduino / Networking, Protocols, and Devices / Re: How do I read the data from a simple single page website (ethernet) (SOLVED) on: July 07, 2012, 04:57:17 am
The server uses name based virtual hosts, i.e., several host names share the same IP address. You need to provide the  Host-header so that the server can decide which virtual host it needs to connect you.

You can easily test the request from your PC before implementing it on the Arduino. For example on Windows start the command prompt and type "telnet myip.dnsdynamic.org 80". When the telnet session is established type the same lines as you would print in the Arduino, e.g:

Code:
GET / HTTP/1.0
Host: myip.dnsdynamic.org

35  Using Arduino / Networking, Protocols, and Devices / Re: How do I read the data from a simple single page website (ethernet) on: July 05, 2012, 12:19:39 pm
And this looks a bit funny:
Code:
client.println("GET /myip.dnsdynamic.org HTTP/1.0");
It  means that you want to request the resource "myip.dnsdynamic.org" on the server.

If you meant to access the root resource of your server, it should be:
Code:
client.println("GET / HTTP/1.0");

Edit: typos
36  Using Arduino / Networking, Protocols, and Devices / Re: How do I read the data from a simple single page website (ethernet) on: July 05, 2012, 11:54:51 am
Add client.println("Host: myip.dnsdynamic.org"); after the line that prints the GET header.

Edit: before -> after
37  Using Arduino / Programming Questions / Re: is there a way to read data from the device? on: July 03, 2012, 02:55:29 am
If you haven't compiled or uploaded anything since the power break, there is a change that you can find the temporary files that the Arduino used for compiling the hex file. If the temp files are still there, you can salvage the C++ source code you wrote.

On Linux temporary files reside below /tmp/build<something> folder.

38  Using Arduino / Programming Questions / Re: If(predetermined situtation); statement? on: July 01, 2012, 10:10:51 am

I think you are wanting from the way you worded that:
Code:
boolean movingForwardRight = FALSE;
if ((x > xx     &&     x < xz)     &&     (y > yy     &&    y < yz))
      {
           movingForwardRight = TRUE;  
     }


Or simply:

Code:
boolean movingForwardRight  = (x > xx     &&     x < xz)     &&     (y > yy     &&    y < yz);
39  Using Arduino / Programming Questions / Re: sketch hangs, makes no sense to me, any help? on: June 29, 2012, 11:53:10 am
The very best way is to cut down the code so that it is very short and still shows the problem.

And there is a good change that while trimming down the code you find the problem yourself.
40  Using Arduino / General Electronics / Re: IR frequency on: June 29, 2012, 06:30:36 am
All that need to be done is chop (pulse) the laser and amplify the received signal a little for detection. No REMOTE CONTROL DETECTORS NO 38KHZ... SIMPLE transmitter and simple receiver.

But the 38kHz detectors are  simple receivers. You only need a capacitor and a resistor to connect the receiver to the Arduino.  It would be more difficult to design and build even the simplest amplifier as you suggested. And it is no more difficult the pulse an IR LED that a laser.
41  Using Arduino / Programming Questions / Re: PulseIn, but then different? on: June 29, 2012, 05:48:01 am
I'm not sure what the "negative flank" means but I'll guess it means the falling edge. The problem you described doesn't sound too complicated. You need two ISRs. The first ISR saves the timestamp into a variable (say t0) using micros(). Remember to use a volatile keyword when you declare the variable. The second ISR subtracts t0 from the current time. The result is the time between the signals.

Edit: typos
42  Using Arduino / Programming Questions / Re: malloc bug? on: June 28, 2012, 01:28:22 pm
Perhaps the compiler optimizes buffer off because you don't use it.
43  Using Arduino / Programming Questions / Re: Attempting to control the flow of a program with a while() function on: June 24, 2012, 04:36:53 am
A switch-type Hall sensor (a.k.a unipolar hall sensor) is more suitable for a speedometer. Instead of analog readings, it returns logical HIGHs or LOWs depending on the presence of a magnetic field. You could then use interrupts to detect the state changes (FALLING or RISING edges). It would make your sketch a lot simpler.
44  Using Arduino / General Electronics / Re: IR frequency on: June 22, 2012, 12:02:26 pm
Doc is certainly much more experienced than I am, but do yourself a favor an believe me in this case. Don't try to go with a plain LDR. Use a real IR detector, such as the one that Grumby_Mike suggested. If you go with a LDR, you will need a whole lot of additional electronics (noise filtering, amplifier etc) just to distinguish your signal from the ambient IR noise.

I actually built a couple of month ago something almost exactly like what you are going to build. I newer quite finished it, but I got the gun and the target working quite well. The shooting distance was about 10-15 feet. From that distance the IR beam diameter on the target was about 2 inches. (Depends on the length and the diameter of the gun's barrel.)

At first I experiment with a photo transistor. It kind of worked at night time, but at day time when sunlight came through windows, it didn't work at all. With an IR detector sunlight wasn't a problem.
45  Using Arduino / General Electronics / Re: IR frequency on: June 22, 2012, 01:14:50 am
If you are willing to lower the distance requirement a bit your project would certainly be doable. Wouldn't say 10-20ft suffice? Even 30ft could be doable if you use an IR diode that has high radial intensity.

Quote
How about 10 or more IR leds driven hard and installed at the far end of a long non reflective tube - I assume the non reflective tube will only emit a narrow beam ?

This wont give you a sharp narrow beam like a laser, but it would give you a narrow angle, i.e., the gun will be more like a shotgun than rifle.  But this is not necessarily a bad thing. The detector area in an IR detector is very small, a few millimeters in diameter. It would be very hard to hit the target if you really had a laser like sharp narrow beam.  Depending on the diameter and length of the tube, the beam diameter at the shooting distance could be an inch or two.  And I don't think you need 10 or more leds though. Try with a single led first.

edit: fixed a few typos
Pages: 1 2 [3] 4 5 ... 18