Show Posts
Pages: 1 ... 375 376 [377] 378 379 ... 580
5641  Using Arduino / Project Guidance / Re: calculate relative direction to destination on: March 25, 2012, 01:10:12 pm
My guess is that "compassvalue()" and mydir use different ranges of angles and currentdir - mydir is coming out positive and therefore always steering right.  Display 'finaldir' on the LCD.  If it ever shows more than 180 or less than -180 you have a mistake.
5642  Using Arduino / Installation & Troubleshooting / Re: Burn 8mhz(internal) bootloader on a 16mhz(external) configured atmega328P on: March 25, 2012, 12:31:24 pm
Thanks for your time johnwasser.
Since both my atmega328P are set to external crystal, how could I use one(into the arduino board) as ISP to burn a 8mhz(internal clock) bootloader on the other(bread board minimal configs)?

You need the crystal and load capacitors on your breadboard until you get the fuses set:

Hardware setup:
http://arduino.cc/en/Tutorial/ArduinoISP

Software instructions:
http://www.arduino.cc/playground/Code/MegaISP
5643  Using Arduino / LEDs and Multiplexing / Re: Blinking an LED a set number of times with respect to analog input...... on: March 25, 2012, 12:21:26 pm
Code:
void loop ()
    {
    int blinks1 = PPO1*10;
    int blinks2 = PPO2*10;
    int blinks3 = PPO3*10;
    int maxBlinks = max(max(blinks1, blinks2), blinks3);

    for (int i=0; i<maxBlinks; i++)
         {
         digitalWrite(red1, blinks1 < i);
         digitalWrite(green1, blinks1 < i);
         digitalWrite(blue1, blinks1 < i);
         digitalWrite(red2, blinks2 < i);
         digitalWrite(green2, blinks2 < i);
         digitalWrite(blue2, blinks2 < i);
         digitalWrite(red3, blinks3 < i);
         digitalWrite(green3, blinks3 < i);
         digitalWrite(blue3, blinks3 < i);

        delay(250);

         digitalWrite(red1,    LOW);
         digitalWrite(green1, LOW);
         digitalWrite(blue1,  LOW);
         digitalWrite(red2,    LOW);
         digitalWrite(green2, LOW);
         digitalWrite(blue2,   LOW);
         digitalWrite(red3,    LOW);
         digitalWrite(green3, LOW);
         digitalWrite(blue3,   LOW);

        delay(250);
        }

        lcd.setCursor(0, 1); //sets the cursor to column 0, line 1   
        inputReading1 = analogRead(sensor1); //getting the voltage reading from the 02 sensor   
        float voltage1 = inputReading1 * aref_voltage1; // converting that reading to voltage
        voltage1 /= 1024.0;   
        lcd.print(voltage1, 2);//print actual voltage to lcd   
        delay(200);
   

        lcd.setCursor(6, 1); //sets the cursor to column 6, line 1     
        inputReading2 = analogRead(sensor2); //getting the voltage reading from the O2 sensor   
        float voltage2 = inputReading2 * aref_voltage2; // converting that reading to voltage
        voltage2 /= 1024.0;
        lcd.print(voltage2, 2);  //print actual voltage to lcd
        delay(200);     
 
 
        lcd.setCursor(12, 1); //sets the cursor to column 12, line 2   
        inputReading3 = analogRead(sensor3); //getting the voltage reading from the O2 sensor   
        float voltage3 = inputReading3 * aref_voltage3; // converting that reading to voltage
        voltage3 /= 1024.0;
        lcd.print(voltage3, 2);  //print actual voltage to lcd
        delay(200);
 
      }
5644  Using Arduino / Project Guidance / Re: calculate amps on: March 25, 2012, 12:05:05 pm
is there any way to measure it with a analog pin?
No. 

Why is it you want to measure the current you "have left"?
5645  Using Arduino / LEDs and Multiplexing / Re: Flashing 3 leds together for one cycle with respect to thier input.... on: March 25, 2012, 11:47:28 am
If you want two things to happen "at the same time" you can't put any delay() calls between the two things.

If you want to use delay() to time your blinks AND you want to blink more than one LED at a time you have to:

turn on ALL the LED's you want to blink this cycle.
delay();
turn off ALL the LED's you want to blink this cycle.
delay();

Because of that you can't have separate blink functions for different LED's.
5646  Using Arduino / Project Guidance / Re: calculate amps on: March 25, 2012, 11:34:00 am
By 'current I have left' do you mean the current available to other circuits?  That will depend on if you are powering the Arduino vis USB (500 mA total) or off the power jack (7-12V, current limit depends on the regulator), or off the 5V pin (5V regulated input, current limit depends on power supply and how you tap into it).

The ATmega chip only uses 10 to 15 mA so the entire Arduino probably uses well under 100 mA. 

With a USB supply this will leave 400 mA or more for your peripherals.

I'm guessing the onboard 5V regulator can handle roughly 1 A so if you provide power via the barrel connector or the Vin pin you might be able to use 900 mA from the 5V pin.

if you connect a regulated 5V supply to the 5V pin you might be able to draw as much as 10A from the 5V pin but you would be better off running a separate wire if you need that much current.
5647  Using Arduino / Sensors / Re: Problems to measure pressure on 4-wire resistive touch panel on: March 25, 2012, 11:17:52 am
I'm surprised that there are pull-down resistors on the input pins.  This tutorial doesn't have that:
    http://make.larsi.org/electronics/TouchScreen/ 
I would expect the pull-down resistors would make everything non-linear and may be what is keeping your pressure equations from working.

This document talks about getting pressure readings:
http://www.ti.com/lit/an/sbaa155a/sbaa155a.pdf

After you get X and Y readings you'll need to take two samples to calculate pressure:

Set +Y HIGH and -X LOW.  Do analogRead() at +X for Z1 and -Y for Z2. (measure repeatedly and average to reduce noise)

Note: if Z1 = 0 then Pressure = 0
Rz = Rx * X/1024 * (Z2/Z1-1);  // Note: Rx is the resistance across the X plane
Pressure = Poffset - Pscale * Rz;  // Poffset and Pscale are determined experimentally.
5648  Using Arduino / Storage / Re: Where to store array of doubles on: March 25, 2012, 09:10:46 am
The problem i see there is that i need to support changing hue both ways - up or down. Basically if i want the color to change from blue to red then the hue value must start decreasing when temperature is rising.

Just add a parameter for clockwise (increasing hue) or counterclockwise (decreasing hue).
Code:
int LedDriverClass::getHue(byte temperature, byte startTemp, byte endTemp, int startHue, int endHue, bool clockwise)
    {
    if (temperature < startTemp || temperature > endTemp)
        return 0;

    if (clockwise && endHue <= startHue)
        endHue += 360;

    if (!clockwise && startHue <= endHue)
        startHue += 360;

    return map(temperature, startTemp, endTemp, startHue, endHue) % 360;
    }
5649  Using Arduino / Storage / Re: Where to store array of doubles on: March 25, 2012, 08:17:05 am
There's no so much calculation there that the Arduino can't do it on-the-fly:
Code:
int LedDriverClass::getHue(byte temperature, byte startTemp, byte endTemp, int startHue, int endHue)
    {
    if (temperature < startTemp || temperature > endTemp)
        return 0;

    if (endHue <= startHue)
        endHue += 360;

    return map(temperature, startTemp, endTemp, startHue, endHue) % 360;
    }
5650  Using Arduino / Sensors / Re: How to read register value from ADXL345 Eval board? on: March 25, 2012, 08:02:06 am
If you encounter a problem you should post a new question on the forum.  That way it will be searchable by others that might have a similar problem in the future.
5651  Using Arduino / Project Guidance / Re: Advice on clock speed. on: March 25, 2012, 07:59:13 am
Code:
                                     
    TCCR1B = PRESCALE; //(1<<ICES1) | (0<<CS12) | (1<<CS11) | (1<<CS10);        // (ICES1) = capture rising edge on pin ICP1(a.k.a Pin 8),  set prescaler to 64 for 16Mhz  = 0X43
TCCR1B is the  Timer/Counter1 Control Register B.
   0x40 = ICES1 = Input Capture Edge Select = RISING
   0x03 =  Divide clock by 64
   Other choices for clock divider are:
    0x01 = No divider
    0x02 = Divide by 8
    0c04 = Divide by 256
    0x05 = Divide by 1024
5652  Using Arduino / Programming Questions / Re: summary of predefined names, routines, macros? on: March 24, 2012, 06:43:22 pm
There may be a summary of the names somewhere but without the information in the datasheet of what bits do what the summary would not be of much use.
5653  Community / Exhibition / Gallery / Re: BOX OF TUNA GPS on: March 24, 2012, 06:36:40 pm
If the GPS is inside the can, how do the satellite signals get to the antenna?
5654  Using Arduino / Installation & Troubleshooting / Re: Brand spanking new Uno will not work on: March 24, 2012, 06:34:28 pm
What error do you get when you try to upload a sketch?
5655  Using Arduino / Installation & Troubleshooting / Re: Burn 8mhz(internal) bootloader on a 16mhz(external) configured atmega328P on: March 24, 2012, 06:33:05 pm
If the target ATmega is set for an external crystal you will have to supply one.  If you have a second Arduino with a removable chip you can put the target processor in that to give it a crystal.
Pages: 1 ... 375 376 [377] 378 379 ... 580