Show Posts
Pages: 1 ... 2247 2248 [2249] 2250 2251 ... 3084
33721  Using Arduino / Project Guidance / Re: LED "bouncing ball effect" on: July 18, 2011, 08:08:21 am
Quote
I will put the code on my next post because Im pretty sure there is a way to make the code scrollable. Please let me know how to do that also!
Up above the window you type text in, there are 2 rows of buttons. On the second row, on the right end, there is a button with a # on it. Select that button, then paste your code.

So, you want to loop through all the LEDs, lighting each one up, then loop through each LED in reverse order, extinguishing them, with a different upper limit on each loop.

Code:
for(int ul = 9; ul>0; ul--) // Determine the upper limit - 9, 8, 7...
{
   for(int i=0; i<=ul; i++)
   {
      // Turn on the ith LED
   }

   for(int i=ul; i>=0; i--)
   {
      // Turn off the ith LED
   }
}
33722  Using Arduino / Programming Questions / Re: Conversion from String.(substring) to float on: July 18, 2011, 08:00:57 am
Quote
I tried *char instead of char after i got an error message telling me there is a cast incompatibility
In what code? If you have a code problem, doesn't it seem reasonable that you should post the code?

Quote
Bij pointing at the char I only get the firts character (5 while i should get 52 )
Once more, without typos, please.

33723  Using Arduino / Programming Questions / Re: Problems with analogread() on: July 18, 2011, 07:57:58 am
Quote
My concern is that it sends the read data 10 times a second(delay(100)) and when I try to upload another code Arduino interface returns error because the device is constantly busy.
To the Arduino, 10 times a second leaves an eternity between sends.

Of course, you could make the time between sends larger, by making the sending of data faster. 9600 baud is pretty slow.

What does your concern about sending so much data have to do with a problem with analogRead?
33724  Using Arduino / Project Guidance / Re: Land-based Fish finder project on: July 18, 2011, 06:50:08 am
You don't need an Arduino on the receiving end. Other than that, the XBees would work quite well.
33725  Using Arduino / Interfacing w/ Software on the Computer / Re: Using ESC with Arduino Mega on: July 18, 2011, 06:28:23 am
Quote
Guys, I am finding some serious difficulties interfacing the esc with the arduino mega.
The ESC, huh? Is it possible for you to provide a bit more information. After all, there are at least two different ESCs made.
33726  Using Arduino / Project Guidance / Re: Land-based Fish finder project on: July 18, 2011, 06:23:18 am
Quote
Obviously that data would need to be captured and sent to the angler (me) - who might be able to view it on on the web via a mobile phone.
How are you going to receive that data? How will that data get from you to the web? With the ending of the Harry Potter movies, I'm pretty sure the magic wands will be available on E-bay soon. Might want to put in a bid.

33727  Using Arduino / Project Guidance / Re: Need simple script to read 1 ppm signal on: July 18, 2011, 06:13:03 am
Quote
I changed it into CHANGE because i tried to read 3 positions of the signal, for example 500microsec, 1000microsec and 1500microsec, but that doesn´t work.
This doesn't make sense.

You are attaching the interrupt handler, requesting that it be called whenever the pin goes from HIGH to LOW or from LOW to HIGH - in other words whenever there is a change.
Code:
  attachInterrupt(0, IRQ, CHANGE);  // both edges

In the IRQ function, you use digitalRead() to see what the change was, if it is important. If the return value is HIGH, the transition that triggered the interrupt was from LOW to HIGH (because the pin is now HIGH). If the return value is LOW, the transition that triggered the interrupt was from HIGH to LOW (because the pin is now LOW).

In the IRQ function, you should record WHEN the function was called, if the digitalRead value is HIGH (the trigger was the pin going from LOW to HIGH), then return.

If the digitalRead value is LOW (the trigger was the pin going from HIGH to LOW), then the time since the last call to IRQ tells you whether the pin was HIGH for the required duration, or not.

It is that duration, or true/false decision based on duration, that loop() should be paying attention to.

It is not clear what the code should do if the PPM signal is HIGH for the required duration, or what it should do if the PPM signal is NOT HIGH for the require duration.

The blinking/fading of the LEDs does not seem to relate to the length of the PPM HIGH pulse that I can see.
33728  Using Arduino / Project Guidance / Re: Need simple script to read 1 ppm signal on: July 18, 2011, 06:01:08 am
Quote
so is there no chance to make it faster?
All that the interrupt handler should do is set a flag that gets looked at on the next pass through loop.
33729  Using Arduino / Programming Questions / Re: Question about the length of commands (how many microseconds...) on: July 18, 2011, 05:58:24 am
Quote
assuming Arduino is female
I think that would be Arduina.
33730  Using Arduino / Programming Questions / Re: Understanding state machines, with regard to temperature control on: July 18, 2011, 05:43:59 am
Quote
it looks like i can have different conditions to move into and out of states
Of course you can. The transition defines how to get from one state to another. That the transition from state n to state m is not the same as the transition from state m to state n is common/expected/normal.
33731  Using Arduino / Project Guidance / Re: Wire logic high, multiple sensors. on: July 18, 2011, 05:14:38 am
Those blue lines to the analog pins need explaining. Are you wiring each board to a separate pin? The wiring diagram is less than clear.

Quote
If this is all right then perhaps I have to start looking at the code.
What is the problem? Are you not getting data from the sensors wired as in the diagram?
33732  Using Arduino / Project Guidance / Re: Sensors to sense hand swiping across on: July 18, 2011, 05:01:06 am
There will be a time associated with each sensor being read/going HIGH or LOW or above or below its previous reading. If sensor n+1's time is greater than sensor n's time, motion is in one direction. Otherwise, motion is in the other direction. Of course, you need to sense direction for each pair of sensors, since the motion may not continue across all sensors, and may indeed change direction.
33733  Using Arduino / Project Guidance / Re: Need simple script to read 1 ppm signal on: July 18, 2011, 03:56:19 am
Code:
  if (digitalRead(2) == CHANGE) { time = micros(); return; }  // set time at high edge
The digitalRead() function returns HIGH (1) or LOW (0). Why are you using CHANGE here?

Quote
the sketch works, but my fade and blink is very very slow.
Your interrupt handler takes forever to complete, so it keeps getting interrupted before it is done.
33734  Using Arduino / Networking, Protocols, and Devices / Re: Using GPS Transmitting to a Computer Wirelessly Via Arduino on: July 17, 2011, 06:25:49 pm
It's not a dumb question at all. Unfortunately, the answer is no. Some shields can be stacked, but the XBee needs to be on top, because of the antenna, and the need to broadcast and receive data, and the GPS needs to be on top, because of the antenna, and the need to receive data.

Also, when using the shields, but shields attempt to use the serial port pins (0 and 1).

There are non-shield breakout boards for both the GPS and the XBee, so either one could be connected using a non-shield arrangement, using other than pins 0 and 1.
33735  Using Arduino / Project Guidance / Re: Need simple script to read 1 ppm signal on: July 17, 2011, 06:03:01 pm
Code:
    // do your thing here
Keep in mind that "your thing" needs to be very fast, Interrupt handlers are not the place to be sending serial data or other activities that take a lot of time.
Pages: 1 ... 2247 2248 [2249] 2250 2251 ... 3084