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 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 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  Wouldn't this be better? A = int(lux_v1); B = int(lux_v2);
|
|
|
|
|
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: GET / HTTP/1.0 Host: myip.dnsdynamic.org
|
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
|
|
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. 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
|
|
|
|
|