Loading...
  Show Posts
Pages: 1 ... 2249 2250 [2251] 2252 2253 ... 2368
33751  Forum 2005-2010 (read only) / Interfacing / Re: Arduino and Blender on: May 25, 2010, 06:45:54 am
Quote
if 'a' == ch
should be
if ch == 'a'

Makes no difference which order the operands appear in. They are being tested for equality.
33752  Forum 2005-2010 (read only) / Interfacing / Re: Corrupt data with Arduino pro mini 3.3v + xbee? on: August 27, 2010, 03:42:21 pm
I have a custom XBee shield that powers the XBee from the 3.3V pin on the Arduino. It sends and receives just fine. I've used the same shield on a Netduino which is a 3.3V device, and it works fine there, too.

So, I don't think it's a voltage issue.

One thing that might be causing a problem, though, is that the 3.3V mini operates at a different clock speed from the 5V mini. The 3.3V mini uses an 8MHz crystal, while the 5V one uses a 16 MHz crystal.

So, you might need to double the baud rate on the 3.3V mini's serial port to get it to communicate successfully with the XBee.
33753  Forum 2005-2010 (read only) / Interfacing / Re: How to integrate Arduino-based Ardupilot with Xbee on: August 27, 2010, 03:27:29 pm
A link is worth a thousand words.
33754  Forum 2005-2010 (read only) / Interfacing / Re: combining video and data signal on: August 24, 2010, 02:06:48 pm
Quote
600 metres ( 656 yards / 7874 feet for the metrically-challenged)
656 yards is 1,968 feet (for the calculator-challenged).
33755  Forum 2005-2010 (read only) / Interfacing / Re: I2C LCD **no data sheet** HOW TO CONNECT on: August 26, 2010, 08:02:28 pm
Try changing the name of the directory to all upper case, to match the file names.
33756  Forum 2005-2010 (read only) / Interfacing / Re: Newbie looking for program debugging-motion sensor on: August 26, 2010, 08:38:52 am
Code:
if (x < 6) {
[glow]  Serial.println("X is less than 6");[/glow]
  digitalWrite(motorPin,LOW);
}

if ((x > 6) && (x < 18) ) {
[glow]  Serial.println("X is between 6 and 18");[/glow]
  digitalWrite(motorPin,HIGH);
  delay(3000);
  digitalWrite(motorPin,LOW);
  delay(3000);

  lightUpOne();

}

if (x > 18 ) {
[glow]  Serial.println("Whoa, X is big!");[/glow]
  digitalWrite(motorPin,HIGH);
  delay(6000);
  digitalWrite(motorPin,LOW);
  delay(3000);

  lightUpTwo();

}

Tell us about the relay. Perhaps it needs more current to activate it than the Arduino can supply.
33757  Forum 2005-2010 (read only) / Interfacing / Re: Newbie looking for program debugging-motion sensor on: August 24, 2010, 11:51:08 am
If x is printing out that it is in the range of the if tests, add some Serial.print statements in each if block, to verify that the block is entered.

If the block is entered, and the pin is set HIGH and the motor does not start, it's a hardware issue. You've provided virtually no details about the hardware.
33758  Forum 2005-2010 (read only) / Interfacing / Re: gateway with arduino and xbee on: August 25, 2010, 07:14:28 am
I'm not convinced that you can use XBees the way you want. The Series 1 models are point-to-point, meaning two of them can communicate with each other.

The Series 2/2.5 models are meant to communicate in a mesh arrangement, with end devices and coordinators.

That having been said, tell us how you have configured the XBees - exactly what you changed (specific values would be nice, but not mandatory if you need to hide something, like PAN ID).

Show us the code running on the 3 Arduinos.
33759  Forum 2005-2010 (read only) / Interfacing / Re: Long distance help?! on: August 25, 2010, 03:28:12 pm
There are breakout boards that allow mounting an XBee, and that breakout all the pins on the XBee. Solder wires in the correct holes, and you're good to go.
33760  Forum 2005-2010 (read only) / Interfacing / Re: Actuator controls - it works, but it doesn't on: August 25, 2010, 10:31:30 am
Where is the serial data coming from?

Quote
It receives two values seperated by semi-colon and is terminated by a line-feed command (ie. 25;75;\n)
If the data is coming from the Serial Monitor, this statement is not true.
33761  Forum 2005-2010 (read only) / Interfacing / Re: PS2 mouse interfacing problem - no XY - on: August 25, 2010, 07:09:30 am
You CAN copy your code, and paste it here (using the # button). Then, those with more experience (or patience or both) can look at it, and maybe even tell you what is wrong (and how to fix it).
33762  Forum 2005-2010 (read only) / Interfacing / Re: Multiple LED's different brightness same time on: August 16, 2010, 05:46:21 am
Quote
It basically seems like it has 5 different levels with that code.
Which code would that be?

Quote
I ran my basic code through it and it seems to work better.
"it"? What is "it"?

Quote
I have to get some different ones anyways just because of color variances.
There will always be color variances. You need to adjust the size of the resistor in line with each leg of each LED to even things out, or use some sort of diffuser.
33763  Forum 2005-2010 (read only) / Interfacing / Re: Multiple LED's different brightness same time on: August 14, 2010, 08:38:32 am
The whole idea behind using millis() is to allow "simultaneous" actions to occurs. Putting delay in there defeats the whole purpose.

If you only want to read the sensor again when the whole 6 LED fading cycle is complete, that is possible. Set a boolean variable to true when a reading needs to be taken (initialized to true). Take a reading only when one is needed (the variable is true). When the fading cycle starts, set that variable to false. Set it back to true when the fading cycle is complete.

However, if you want the sensor to act as a switch, and turn the entire fading cycle on and have it run to completion, forget about millis and not using delay.

Create a single for loop that sets the appropriate value for all 6 pins, write the pin values, and delay for however long you want.
33764  Forum 2005-2010 (read only) / Interfacing / Re: Multiple LED's different brightness same time on: August 13, 2010, 11:29:31 am
Suppose you were dimming the LED manually, using a potentiometer. Suppose the brightness needed to change every hour. You have a watch.

You'd set the potentiometer, and write down the time you last changed the potentiometer. Every so often, you'd check your watch to see if it was time to change the potentiometer setting. If it was, you would move the potentiometer, and write down the new time.

Well, on the Arduino, the "every so often" is every pass through loop. Checking your watch is calling millis(). The other steps are pretty obvious.

The BlinkWithDelay example changes the state of the LED, from on to off or from off to on. What you want to do is change the brightness of the led.

Code:
int increment = +1;
int pwmVal = 0;
unsigned long lastChange = 0;
unsigned long interval = 100;

void loop()
{
   unsigned long now = millis();
   if(now - lastChange > interval) // See if it's time
   {
      pwmVal += increment; // Set the new value
      analogWrite(pwmPin, pwmVal); // Write the new value

      // If we are at maximum or minimum, change direction
      if(pwmVal == 255)
         increment = -1;
      if(pwmVal == 0)
         increment = +1;

      lastChange = now;
   }
}
33765  Forum 2005-2010 (read only) / Interfacing / Re: Multiple LED's different brightness same time on: August 13, 2010, 08:24:55 am
The BlinkWithoutDelay example will provide some inspiration and direction.

Basically, instead of setting an alarm and going to sleep (delay()), you keep track of when it is time to do things. Periodically, you check your watch (millis()), and see if it is time to do any of the things that might need to be done.

The things you have identified that you want to do are to change the PWM value of 6 different pins. All the pins change value at the same time (or near enough). The value of each of the pins is going to to be different. The easiest way to accomplish this is to have an array of pin values and pin numbers. On each pass though loop, see if it is time to change the pin values and write the new values to the pins. If it is, update the values, and write them to the pins.

Of course the pin value for any one pin will depend on the pin value of the preceding pin, except for the first one.

Hopefully, this will give you enough direction to get started. If you have problems getting it working, post your code and describe your problems, and we'll try yo help.
Pages: 1 ... 2249 2250 [2251] 2252 2253 ... 2368