Show Posts
Pages: 1 ... 382 383 [384] 385 386 ... 539
5746  Using Arduino / Displays / Re: how to chose LCD on: January 25, 2012, 03:58:59 pm
The Arduino is probably not a good choice if you want to display on a large LCD screen like one would find in a laptop.  Typically we use a display with a built-in controller that has a buffer for the characters or pixels.  Such displays are typically 4x20 (four lines of twenty characters) or 128x64 pixels.
5747  Using Arduino / Project Guidance / Re: Standalone ATMega328 and 3.3v Requirement on: January 25, 2012, 03:50:20 pm
The extra regulator will need its own capacitors.

Using a simple /2 voltage divider (two equal resistors of about 10K) works well for 5V outputs to 3.3V inputs.  Nothing special is needed for 3.3V outputs going to 5V inputs.
5748  Using Arduino / Sensors / Re: IR Tripwire on: January 25, 2012, 03:46:28 pm
These devices are designed for short bursts of pulses used for remote control.  The specification says:

"Some examples of disturbance signals which are suppressed are:
• Continuous signals at any frequency"

After it sees a long burst (>70 cycles at 38KHz, about 2 milliseconds) it ignores that signal until that signal has been gone for four times the burst length.

You need an IR receiver designed for continuous signals.
5749  Using Arduino / Sensors / Re: help with led IR high intensity on: January 25, 2012, 12:15:03 pm
I ask again:
Is the IR light pointed at the receiver or does the receiver have to detect the IR no matter which way it is facing?

If you are trying to send data it might be safer to send a modulated pulse train like a TV remote control uses.  If you are just using time between pulses you will get a wildly different value if you miss a pulse.
5750  Using Arduino / Sensors / Re: help with led IR high intensity on: January 25, 2012, 11:49:19 am
Are you trying to send data or just detect the presence of the IR light?

Is the IR light pointed at the receiver or does the receiver have to detect the IR no matter which way it is facing?
5751  Using Arduino / Programming Questions / Re: DC motor Steering control through POT on: January 25, 2012, 11:43:06 am
Code:
void motorLeft() {
  digitalWrite(leftMotor, HIGH);
}
void motorRight() {
  digitalWrite(leftMotor, HIGH);
}

rightMotor, perhaps?

Yes, that second one should be rightMotor.

(corrected in original post)
5752  Using Arduino / Programming Questions / Re: DC motor Steering control through POT on: January 25, 2012, 11:18:25 am
Try this:
Code:
const int potPin = A0;

const int leftMotor = 10; //PWM pin to the L293
const int rightMotor = 9; //PWM pin to the L293

bool isLeft()          {
  return analogRead(potPin) < 52;
}
bool isLeftOfCenter()  {
  return analogRead(potPin) < 472;
}
bool isRightOfCenter() {
  return analogRead(potPin) > 532;
}
bool isRight()         {
  return analogRead(potPin) > 976;
}

void motorStop() {
  digitalWrite(leftMotor, LOW);
  digitalWrite(rightMotor, LOW);
}
void motorLeft() {
  digitalWrite(leftMotor, HIGH);
}
void motorRight() {
  digitalWrite(rightMotor, HIGH);
}


void setup() {
  Serial.begin(115200);
  Serial.println ("Entering setup.");
}

void loop()
{
  if (Serial.available() == 0)
    return;

  switch (toupper(Serial.read()))
  {
  case 'L':
    Serial.println("New command: L");
    if (isLeft())
      Serial.println("Already Left");
    else
    {
      Serial.println("Heading Left");
      motorLeft();
      while (!isLeft()) /* JUST WAITING */;
      motorStop();
      Serial.println("Is now Left");
    }
    break;

  case 'C':
    Serial.println("New command: C");
    if (isRightOfCenter())
    {
      Serial.println("Heading Left toward Center");
      motorLeft();
      while (isRightOfCenter()) /* JUST WAITING */;
      motorStop();
      Serial.println("Is now Centered");
    }
    else
      if (isLeftOfCenter())
      {
        Serial.println("Heading Right toward Center");
        motorRight();
        while (isLeftOfCenter()) /* JUST WAITING */;
        motorStop();
        Serial.println("Is now Centered");
      }
      else
        Serial.println("Already Centered");


    break;

  case 'R':
    Serial.println("New command: R");
    if (isRight())
      Serial.println("Already Right");
    else
    {
      Serial.println("Heading Right");
      motorRight();
      while (!isRight()) /* JUST WAITING */;
      motorStop();
      Serial.println("Is now Right");
    }

    break;

  }  // end of switch on direction

}  // end of loop
5753  Using Arduino / Displays / Re: What version of Arduino do I need to get the tiger.bmp onto an adafruit shield on: January 25, 2012, 10:45:26 am
Perhaps the SD library you are using doesn't have support for the newer SD-HC format used for 4GB and larger SD cards.  Or maybe the card hads not been pre-formatted for FAT16 or FAT32.
5754  Using Arduino / General Electronics / Re: How on/off device with relay with pulses from Arduino? on: January 25, 2012, 10:30:14 am
Get a dual-coil latching relay with 5V coils that draw less than 40 mA:

http://search.digikey.com/us/en/products/TX2-LT-5V-TH/TX2-LT-5V-TH-ND/2709470

Connect the two coils to two Arduino pins.  One will turn the relay ON permanently.  The other will turn the relay OFF permanently.  No power is needed to keep the relay in position.  The contacts can handle 2A at 250 VAC or 220 VDC.

For higher current (10 A) you could try this one:

http://search.digikey.com/us/en/products/DK1A-L2-5V-F/255-2054-ND/1242202
5755  Using Arduino / Sensors / Re: Logic high? on: January 25, 2012, 08:39:45 am
Logic High means on the output pin:

I think you got the timers mixed up.  The 250 mS was after power-up.  The pulse was 20 uS.

Code:
delay(250);  // or more to make sure power is up on the sensors.
pinMode (pinX, OUTPUT);
digitalWrite (pinX, HIGH);
delayMicroseconds(20);  // Keep the line high for 20 microseconds
pinMode (pinX, INPUT);  // now high impedance
digitalWrite(pinX, LOW);  // Make sure the internal pull-up is off
[/quote]
5756  Using Arduino / General Electronics / Re: How on/off device with relay with pulses from Arduino? on: January 25, 2012, 08:10:54 am
Why do you want to use a 555 timer and MOSFET with a relay?!?

What, exactly, do you want to do?
5757  Using Arduino / General Electronics / Re: Rotary Encoder Tutorial port to Arduino Uno on: January 25, 2012, 08:05:42 am
Code:
old_AB |= ( ENC_PORT & 0x03 );  //add current state

One thing they forgot to mention is that the two pins MUST be the bottom two bits of the port.

Your choices are:
PIND 0,1 (Serial port, probably not a good choice)
PINB 8,9  (Probably a good choice)
PINC A0,A1  (The pins used in the example)

Alternatively you can select other pairs of adjacent pins with a shift before the mask:

For 2,3 change the code to:
Code:
old_AB |= ( (PIND >> 2) & 0x03 );  //add current state

For 3,4 change to
Code:
old_AB |= ( (PIND >> 3) & 0x03 );  //add current state

For A4,A5 change to:
Code:
old_AB |= ( (PINC >> 4) & 0x03 );  //add current state

5758  Using Arduino / Programming Questions / Re: DC motor Steering control through POT on: January 24, 2012, 11:07:00 pm
I am certainly hoping that cutebuddy6 can fix this particular problem on his or her own.

I gave up on that hope about 5 pages back. smiley-sad
5759  Using Arduino / Programming Questions / Re: Parsing Json Arrays on: January 24, 2012, 11:01:56 pm
aJsonObject* sensorConfig[] = aJson.parse(buff);

generates "error: initializer fails to determine size of 'sensorConfig'"

The compiler can't set aside room for an array of pointers without knowing at compile time how many pointers you need.

Typically you would create a fixed size array of pointers and then fill the pointers as you parse the input.
5760  Using Arduino / Programming Questions / Re: DC motor Steering control through POT on: January 24, 2012, 10:31:41 pm
Quote
but has the same issue its doesn't auto detect that i am in left

I don't understand. What is this "auto detect"? Can you describe what it is doing, and what you expect it to do?

I think what he(?) means is that when the desired position is achieved he wants's a message saying so.

He doesn't say so but I think he wants the command "L" to respond with either "Already at left." or "Turning left" followed by "At left" when the pot gets to the desired range.
Pages: 1 ... 382 383 [384] 385 386 ... 539