Show Posts
Pages: 1 ... 423 424 [425] 426 427 ... 592
6361  Using Arduino / Microcontrollers / Re: Testing whether a pin is an interrupt on: July 22, 2011, 08:58:02 am
Quote
Great! I can just auto-include that file!
I think you still need to organize your own include file, io.h in turn includes ioxxx.h depending on the chip that's being used. However that included file does not have any definitions for the interrupt pins AFAIK. I am suggesting that you can use io.h as a template to create your own file in the format you need.

Quote
all of the I/O pins can generate a 'Pin Change Interrupt'.
Good point Don, I was assuming just the external int pins.

______
Rob


6362  Using Arduino / Networking, Protocols, and Devices / Re: More than one Slave RS232 on: July 22, 2011, 08:42:37 am
The serial signals on Arduino are not RS-232, that is an electrical spec that specifies voltage levels among other things.

So, apart from that yes you can link several Arduinos on a serial connection, you just have to choose appropriate line drivers and for this sort of thing RS-485 is normally the recommended standard.

With RS-485 you implement a "half duplex" connection, which basically means only one device can talk at a time, so you do what you have been thinking, a master sends a packet to the "network", all slaves read this packet and the addressed slave takes action on it.

Depending on the nature of your application (ie how important the data reliability is) this can be very simple or quite complex.

Quote
long cable length
How long and how fast?

______
Rob
6363  Using Arduino / Programming Questions / Re: 'class String'has no memeber names 'setArray' on: July 22, 2011, 06:34:45 am
Looking at the code it seems that all get/setArray does is an assignment, so I think you can make the following substitutions

Code:
TextString lcdOutput = TextString( 9 );
 lcdOutput.setArray("108.0MHZ" );    // Just a template...

to
 
Code:
TextString lcdOutput;
lcdOutput= "108.0MHZ";    // Just a template...

and

 
Code:
lcd.printIn( lcdOutput.getArray() );

to

 
Code:
lcd.printIn( lcdOutput );

The only other member you use is setCharAt() and this does seem to be supported by the String class.

EDIT: Actually you overwrite the "108.0MHZ" anyway in the following code so there's no point assigning that default string.

______
Rob

 
6364  Using Arduino / Programming Questions / Re: 'class String'has no memeber names 'setArray' on: July 22, 2011, 06:12:07 am
I had no idea what class TextString was so went and had a look. Looks like it's been replaced by String and String doesn't have those two members, normally in that case I would look at the code for get/setArray in the old class, see what it does and see if there's a member in the new class that does the same thing.

Unfortunately TextString doesn't appear to have those members either so I don't know where that code you have got them from.

I'll have a look at your code and see if I can see what it's doing and recommend a change.

______
Rob
6365  Using Arduino / Programming Questions / Re: 'class String'has no memeber names 'setArray' on: July 22, 2011, 05:00:28 am
Class string does not have that member AFIAK, you have declared "lcdOutput" as a TextString, what is that. Presumably not a String.

If you just changed TextString to String and String doesn't have setArray/getArray member then it won't work.

______
Rob
6366  Using Arduino / Displays / Re: 4D LABS μLCD-32PT(SGC) 3.2” Serial LCD Display Module Arduino Library on: July 22, 2011, 04:42:02 am
I guess they thought auto sizing is a good idea, which on occasion it is, but I think fixed button sizes are better most of the time.

______
Rob
6367  Using Arduino / Sensors / Re: Thermocouple amp with MUX on a mega on: July 22, 2011, 01:01:36 am
I always thought it was not a good idea to run t-couples through a MUX, still if it works it works.

Code:
while(1)
  {
    delay(1000);
    Set_Mux_Channel(1); <<<<<<<<<<<<<< should be a variable, not 1

You never select the other channels. Also you don't need the while(1) but it doesn't do any harm.

Quote
you can have multiple SPI devices provided you use different CS pins?
That's normally true, but I'm not familiar with the SPI library so don't know how it does the CS stuff.

______
Rob
6368  Using Arduino / Programming Questions / Re: Virtual switch on: July 22, 2011, 12:50:56 am
Quote
All I need to do really is touch two wires together momentarly.
The problem is you don't know exactly what's on those two wires. It is possible that just applying a logic level to one of them and GND or 5V to the other will work, but you don't know that without proper documentation.

Therefore the only safe way is with a relay of some kind.

Get some proper data and there may be other options.

______
Rob
6369  Using Arduino / Programming Questions / Re: 12 button Keypad input into a string on: July 22, 2011, 12:39:58 am
You simply get the characters one by one and add them to an array. Something like this

Code:
char password[5];  // one extra char to null terminate the string
memset (password, 5, 0);  // clear the array
for (int i = 0; i < 4; i++)
  password[i] = getKey();

I'm not familiar with the keypad library and I've assumed getKey() doesn't return until a key is pressed. If getKey() returns a value indicating there was no key pressed the code would be more like this.

Code:
char password[5];  // one extra char to null terminate the string
memset (password, 5, 0);  // clear the array
int k;
for (int i = 0; i < 4; i++) {
  do {
     k = getKey();
  } while (k == -1);
  password[i] = k;
}
______
Rob

6370  Using Arduino / Programming Questions / Re: How do you program Machine Lauguage into Arduino / ATmega on: July 21, 2011, 11:10:04 pm
Quote
using digitalWrite ( pin, State ) Does Not Send at the same time.
That's true, however if that's all you need to do then you don't need to drop into ASM, C code like

PORTB = 0x55;

Will be just as good.

______
Rob
6371  Using Arduino / General Electronics / Re: Microcontroller? We don't need no microcontroller! on: July 21, 2011, 07:59:26 pm
Quote
Maybe we should have another thread ...
Yep, maybe under Exhibitions or Bar sport. I'm sure there's a lot of old projects people would display.

______
Rob
6372  Using Arduino / Microcontrollers / Re: Testing whether a pin is an interrupt on: July 21, 2011, 07:53:45 pm
In the Arduino install

C:\Program Files\Arduino\arduino-0021\hardware\tools\avr\avr\include\avr

there is a file called io.h

This has includes for every AVR type based on a value defined elsewhere (maybe on the GCC command line although I don't see it there).

Anyway if this definition is always in place (and it has to be to get the right processor include file) you can use that to have a processor-specific #define.

______
Rob
6373  Using Arduino / Microcontrollers / Re: Testing whether a pin is an interrupt on: July 21, 2011, 07:45:15 pm
Quote
So I would need list of defines, maybe, for every AVR?
That's my thinking, isn't there pre-defined processor types like "__ATMega328__"? I remember playing with something like that a while back.

Otherwise use a #define at the top of the code, but of course this means the user has to figure out which pin is which

______
Rob
6374  Using Arduino / Programming Questions / Re: How do you program Machine Lauguage into Arduino / ATmega on: July 21, 2011, 07:09:27 pm
I used to do all projects in ASM both commercial and personal, mainly because cross-compilers were very expensive at the time. After a while you find that you have such a library of macros and functions that it's almost like writing in C.

These days it's seldom necessary but I agree it's good to know what's under the hood. I have a project coming up (on an ATtiny84) that will probably be written in ASM, so it still has it's place.

______
Rob
6375  Using Arduino / Microcontrollers / Re: Testing whether a pin is an interrupt on: July 21, 2011, 06:52:26 pm
The only way I can think of to test for this at run time is a static table, much the same as used by Arduino for the pin mapping.

But you said "provided they are using arduino cores" so it will only work with Arduinos anyway won't it?

______
Rob
Pages: 1 ... 423 424 [425] 426 427 ... 592