Show Posts
Pages: 1 ... 796 797 [798] 799 800 ... 1119
11956  Forum 2005-2010 (read only) / Syntax & Programs / Re: working on buttons and can't find the problem. on: August 17, 2009, 08:20:54 pm
Quote
Also this resistor will cause the arduino to sink 2.3 mA through the resistor when the button is pressed. Even with a 4 buttons pressed, that's only 9 mA, which the IC can easily handle.

Actually when using external pull-up or pull-down resistors, virtually no current is being sunk or sourced via the Arduino IC. A AVR input pin is a very high impedance input, so the current flowing through an external resistor is being sourced via the 5vdc regulator IC, not the Arduino. It's only when an AVR I/O pin is programmed as a output pin, does source or sink currents pin specifications come into play.

Lefty


11957  Forum 2005-2010 (read only) / Syntax & Programs / Re: Control a Servo -How? on: August 05, 2009, 08:13:36 pm
Quote
What sort of logic does a typical hobby servo use to decode the pulse train, and how does the changing the frequency of the signal affect it?

Here is an article that goes into some details of a very popular servo control chip, the NE544, that for decades was the standard device used inside of many servos.

http://www.seattlerobotics.org/encoder/200009/Servos.html

Lefty
11958  Forum 2005-2010 (read only) / Syntax & Programs / Re: Control a Servo -How? on: August 01, 2009, 11:09:02 pm
The best way is to utilize the library routine designed to support servos. The MegaServo library is the most comprehensive one at the present time. It's located in the Arduino playground site and has the files to download, instructions on use and an example sketch.

http://www.arduino.cc/playground/Code/MegaServo

Lefty
11959  Forum 2005-2010 (read only) / Syntax & Programs / Re: Input pin always reads high, even with nothing on: July 16, 2009, 04:15:11 pm
Quote
But there's no resistor in the current path?  it doesn't hurt the chip to have a short circuit?

When an Arduino pin is programmed to be an input pin it is a high impedance load and will draw almost no current, so with a external pull down resistor the only current draw is from the ground through the external pull down resistor to the external voltage source, ohms law can help you determine the amount of current that the pull down resistor will draw. Now grounding a Arduino pin that is programmed to be an OUTPUT pin and setting the pin to high in software will cause a short circuit and damage the pin. Conversely wiring an output pin to +5vdc and setting the pin to a low output will also cause a short circuit and damage the pin, But Arduino pins set to input mode can only really be damaged by wiring to voltages above or below the maximum allowed, generally 0 volts and +5vdc ( so no negitive voltages of volts above +5volts allowed) for 5 volt systems.

That make sense?

Lefty
11960  Forum 2005-2010 (read only) / Syntax & Programs / Re: Adding a Subroutine to a perfectly good program on: August 02, 2009, 10:06:37 pm
One setup function only, you will have to combine any initialization code from the two programs into the single setup function.

As far as how to call the second program from the first, you will have to 'wrap' the second program inside a new function statement which will include the code from your second program. There is no need for a break from the new function as it will proceed to the next statement on the calling program when it completes. The return word is used to return/assign a value to calling program if it is required in your coding, otherwise the return is automatic when the new function reaches it's last statement.



Lefty
11961  Forum 2005-2010 (read only) / Syntax & Programs / Re: 2 or more inputs high to switch an output on: August 01, 2009, 12:37:14 pm
Quote
digitalWrite( digitalRead(input1) && digitalRead(input2) );

How does digitalWrite function know which pin to write to?

Lefty

11962  Forum 2005-2010 (read only) / Syntax & Programs / Re: Telescope RA Controller Project on: July 27, 2009, 07:08:09 pm
Interesting application and I can appreciate the timing tolerance one requires for telescope work. I can't really help you with timer questions but the 16mhz crystal controlled clock used by the Arduino should be pretty good. One thing your program might include is fast and slow trimming switches so that you could tweak the speed of the RA in real time to compensate for any variables. This would just add or subtract from some timer preload value.

Lefty
11963  Forum 2005-2010 (read only) / Syntax & Programs / Re: How to send CTRL+A and other commands over serial? on: July 28, 2009, 01:48:09 pm
Simplest way to determine is to use a general purpose serial terminal program on your PC that will show the Received characters sent from the Arduino in any base desired. I like brey terminal:

http://braypp.googlepages.com/terminal

Lefty
11964  Forum 2005-2010 (read only) / Syntax & Programs / Re: 2 leds off one command? on: July 26, 2009, 07:35:21 am
It's also possible to wire two LED's to one output pin. Wire them in series and size the current limiting resistor for proper 20ma and the one output pin will light or turn off both LEDs.

Lefty

11965  Forum 2005-2010 (read only) / Syntax & Programs / Re: creating a lookup table (array storage issues?) on: July 22, 2009, 08:13:07 pm
I'm pretty sure that const variables still get assigned to SRAM memory ram not FLASH program ram, at least that is my memory from past threads on this subject.

Lefty

11966  Forum 2005-2010 (read only) / Syntax & Programs / Re: creating a lookup table (array storage issues?) on: July 22, 2009, 09:31:25 am
Well your problem is related to understanding of the Harvard architecture used by the AVR processors.

There are three types of memory available in a typical AVR chip. For a 168 processor there is 16KB of flash memory that holds your program instructions, just 1KB of SRAM that hold program variable data (like your arrray's data) and 512 bytes of EEPROM of general purpose memory. An array would normally be assigned memory from the SRAM so it's clear that your array size is too large for a 168 chip.

 Possible solution would be:
Go to a 328 chip which doubles the memory available in each of the types. It's a plug and play replacement for most Arduino boards that use a 28 pin DIP package.

Or store your array in FLASH program memory using the PROGMEM function. http://arduiniana.org/libraries/flash/

You can also use the EEPROM memory to store array data and fetch it back but I think using PROGMEM is a cleaner way to go and the EEPROM is not large enough anyway if you are using the 168 chip.

Lefty
11967  Forum 2005-2010 (read only) / Syntax & Programs / Re: analog input code question on: July 20, 2009, 07:42:14 pm
Yes it does sound like you are a little off in your use.
It your intent is to activate a LED and solenoid when the audio level reaches or is above a certain volume then you really should do a little hardware conditioning on the audio signal before you wire and read it with the Arduino analog input pin.

You should first rectify the audio signal with a bridge rectifier and then followed with a RC filter. This will then give you a smooth DC voltage level that reflects the average voltage level of the audio signal level at any given point in time when you read the analog input pin.

 Remember the Arduino analog input pin is designed to process DC voltages only that can vary from ground to +5vdc. An audio signal is a AC voltage that has both positive and negative instantaneous values.

Lefty
11968  Forum 2005-2010 (read only) / Syntax & Programs / Re: Arduino Stress Test on: July 20, 2009, 10:11:27 am
Quote
By the way, is it possible to overclock the arduino?
Maybe by giving it a faster crystal?

Yes, that is possible. I think most of the AVR chips used on the Arduino have a max rated speed of 20mhz if powered from 5vdc, less speed if powered by less then 5vdc. The spec sheets for specific AVR chip will have their ratings. Over speeding by increasing the external crystal frequency is possible to soom degree but you are on your own and some of the Arduino AVR software will probably not work at all if not run at exactly 16mhz (or 8mhz for some chips). And again even assuming you could run at some speed in excess of 16mhz it would also be effected by what the external I/O current load is so unless you have external loads representing what your application is doing then it would not mean anything realistic.

Lefty
11969  Forum 2005-2010 (read only) / Syntax & Programs / Re: Arduino Stress Test on: July 19, 2009, 08:57:39 pm
Not easy as a lot of the power dissipation specifications are dependent on having electrical loads on output pins. So I would think that a lot of resistors would have to be wired to the digital pins to simulate normal or worst case electrical loads.

Lefty

11970  Forum 2005-2010 (read only) / Syntax & Programs / Re: serial control of four servos on: July 18, 2009, 06:12:22 pm
Well the normal way to drive servos is with one of the library servo routines. Is there a reason you are 'bit banging' rather then using the proven library?

http://www.arduino.cc/playground/Code/MegaServo

Lefty
Pages: 1 ... 796 797 [798] 799 800 ... 1119