Show Posts
Pages: 1 ... 329 330 [331] 332 333 ... 579
4951  Using Arduino / Programming Questions / Re: Converting string from Serial to int on: June 30, 2012, 07:16:34 am
wily.read() returns a single character.  You could send the characters '0' though '9':
Code:
char val = wifly.read();
int x = map(val, '0', '9', 0, 255);
analogWrite(3, x);

Or for more precision you could send the characters 'A' though 'Z':
Code:
char val = wifly.read();
int x = map(val, 'A', 'Z', 0, 255);
analogWrite(3, x);
4952  Using Arduino / Programming Questions / Re: Magnetometer problems on: June 30, 2012, 06:35:25 am
You should probably start with the basics.  Are the raw X, Y and Z values you get from the magnetometer exactly what you expect?
4953  Topics / E-Textiles and Craft / Re: New to Muscle Wires and Arduino on: June 30, 2012, 06:20:41 am
Are you sure your Flexinol is 0.001 inches in diameter?  That would use 20 mA, not 1000 mA.  The 1000 mA stuff is 0.010 inches.

http://www.robotshop.com/ca/PDF/flexinol-technical-data.pdf

If you DO have 0.001" Flexinol which needs only 20 mA then you could drive it directly from an Arduino pin.  You will need 250 Ohms of total resistance (at 5V, 5/0.020). The Flexinol is 45 ohms per inch so if you used, say, a three inch length of Flexinol that would be 135 Ohms (45 * 3).  To get the total to 250 that would call for a 115 Ohm resistor.  The resistor would be taking about half the voltage (115/250=0.46) or 2.5V.  Two and a half volts at 20 mA is 0.05 Watts so even a tiny 1/8W (0.125W) resistor will be big enough.
4954  Using Arduino / Programming Questions / Re: How to access more than one HALL sensor? on: June 30, 2012, 05:57:14 am
interrupt 0 is pin 2 and 1 is pin 3 right?

Yes, and on the Mega: 2 is pin 21, 3 is pin 20, 4 is pin 19 and 5 is pin 18.  The pins are listed in the documentation for attachInterrupt():

http://arduino.cc/en/Reference/AttachInterrupt

Here are some libraries that help with using 'pin change' interrupts:

http://arduino.cc/playground/Main/PinChangeInt
http://arduino.cc/playground/Main/PcInt

Here is some background information and examples:  http://arduino.cc/playground/Code/Interrupts
4955  Using Arduino / Programming Questions / Re: How to access more than one HALL sensor? on: June 29, 2012, 07:17:45 pm
The  Arduino UNO only has two external interrupts, on pins 2 and 3.

To use three interrupts you would need an Arduino MEGA which has external interrupts on pins 2, 3, 21, 20, 19, and 18.

Neither has interrupts on pins 8, 9, and 10.
4956  Using Arduino / Project Guidance / Re: how to flash and led over IR on: June 29, 2012, 03:12:45 pm
You might want to try the IRremote library.  You will need a receiver module.

You have to decide exactly what you mean by 'flash'.

You should be aware that the receiver can only receive one signal at a time.  If two Arduinos send at the same time it is likely that neither message will get through.
4957  Community / Products and Services / Re: Spray on Batteries on: June 29, 2012, 03:08:06 pm
"One limitation of the technology is in the use of difficult-to-handle liquid electrolytes and the need for a dry and oxygen-free environment when making the new device."

Sounds like it will be a while.

"The researchers tested the device using nine bathroom tiles coated with the paint and connected to each other. When they were charged, the batteries powered a set of light-emitting diodes for six hours, providing a steady 2.4 volts..

If they were in series that means 0.27V each.  smiley-sad

"A set" might be 2.  They might be running the 'set' at 5 mA.  That would make the capacity of those 9 batteries 0.03 mAh (0.003 each).
4958  Using Arduino / Storage / Re: Is there a SD Tutorial? on: June 29, 2012, 03:01:22 pm
http://arduino.cc/en/Reference/SD/
http://arduino.cc/en/Reference/SDCardNotes

You don't need external power.  Looks like it has a built-in 3.3V regulator so you can power it from the +5V pin which can supply about 400 mA.

It's not clear if they support both 3.3V and 5V logic.  Doesn't look like enough resistors to do that and they don't provide a schematic.  The Arduino inputs will work with 3.3V logic and the SD-card inputs will probably work if you put a voltage divider on each.  Two 1k resistors in series between the Arduino output pin and Ground.  The signal between the two resistors (2.5V) should be safe for the SD-card inputs.
4959  Topics / E-Textiles and Craft / Re: New to Muscle Wires and Arduino on: June 29, 2012, 09:43:27 am
You can't draw 1000 mA from an Arduino pin.  40 mA is the absolute max. 20 or 30 mA would be a good limit.  You can use an Arduino pin to switch higher currents using a transistor.  A Google search for 'Arduino transistor' will turn up examples and tutorials.

You can't draw 1000 mA from the Arduino 5V regulator.  That's the regulator's limit and you need some power to run the Arduino.

You can't draw 1000 mA from the USB cable.  They are limited to 500 mA.

If the resistance of the wire is much more than 5 Ohms you will need a voltage higher than 5V to push 1A through it.

If the resistance of the wire is much less than the voltage you are using you will need some way to limit the current so you don't melt the wire.  A series resitor would do it but will need to be able to handle the power dissipation.
4960  Using Arduino / Programming Questions / Re: How can I calculate processor usage? on: June 29, 2012, 08:52:34 am
One thing you can do is turn on an LED at the top of loop() and turn it off when you do any useful work.  The brightness of the LED will give you a sense of how much idle time you have.
4961  Using Arduino / Project Guidance / Re: SPI on ATTiny85 on: June 28, 2012, 05:02:59 pm
The ATtiny85 is not used in any actual Arduino so support for SPI probably depends on what ATtiny 'core' you chose.
4962  Using Arduino / Project Guidance / Re: USB Game Controller Device on: June 28, 2012, 01:29:40 pm
What I meant was program the chip and use it independent of the arduino. Is that possible?

Yes, it is possible if you provide power, crystal, and some other support circuitry.  The hard part is making connections to the tiny pins of an SMD.  If you don't want to buy an existing breakout board you will probably have to design a custom circuit board of your own and learn surface-mount soldering techniques.
4963  Using Arduino / Programming Questions / Re: Arduino as a Switch on: June 28, 2012, 12:51:24 pm
It appears to me from the schematic that the jumpers pull the lines to Ground.  In that case the voltage doesn't really matter and al you need is a digital pin that you set to OUTPUT, LOW to simulate a jumper and INPUT to simulate a removed jumper.

Code:
//  Step through every combination of pins 2 through 9
for (i=0; i<256; i++)
    {
    for (pin = 0; pin < 8; pin++)
        if (i & 1 << pin)
            {
            //  Jumper Absent
            pinMode(2+pin, INPUT);
            digitalWrite(2+pin, LOW);
            }
        else
            {
            //  Jumper Present
            pinMode(2+pin, OUTPUT);
            digitalWrite(2+pin, LOW);
            }

    //  Now that the 8 pins are set you can simulate a button press.
    }
 
4964  Using Arduino / Project Guidance / Re: USB Game Controller Device on: June 28, 2012, 10:47:14 am
I have already purchased an UNO. Would it be feasible to purchase only the ATmega32u4, rather than purchasing a Leonardo?

If you mean "install an ATmega32u4 in place of the ATmega328P on the Arduino UNO", then no.  The 32u4 doesn't come in a 28-pin DIP package so it will not fit in the Arduino UNO socket.

If you mean "build a Leonardo clone using a bare processor" then that is possible.  Since it only comes in surface-mount form you won't be able to plug one into a breadboard.  You will probably want to get a breakout board for it.  Adafruit has one for $19.90 (about $0.10 less than a Leonardo): http://www.adafruit.com/products/296  Sparkfun has one for $19.95: http://www.sparkfun.com/products/11117

4965  Using Arduino / Project Guidance / Re: USB Game Controller Device on: June 27, 2012, 09:40:07 pm
Game controllers come under the heading of Human Interface Devices (HID).  If you get an Arduino Leonardo you can use the standard libraries to make it act as a USB HID.  See File->Examples->09.USB(Leonardo) for some examples.

You can similarly do that sort of thing with the USB-to-Serial chip on the Arduino UNO but it's much harder.
Pages: 1 ... 329 330 [331] 332 333 ... 579