Show Posts
Pages: 1 ... 425 426 [427] 428 429 ... 591
6391  Using Arduino / Programming Questions / Re: Help with delays on: July 18, 2011, 08:29:58 pm
I can see nothing really wrong with the code, so it's probably the resistor retrolefty mentioned.

You are saving the millis() value for no reason, I assume this is a start at a version that doesn't use delay().

Also you aren't debouncing the button, but in this program that won't matter.

RE the LED, if you control through a transistor in the normal way that will invert the signal, that is how things work. But for a single LED you don't need a transistor, just a current-limiting resistor.

______
Rob
6392  Using Arduino / Networking, Protocols, and Devices / Re: RFD21733 2.4Gz Transceiver on: July 18, 2011, 08:11:03 pm
Hi katapulp, I can't help with these modules but they look good. Xbee is the default "standard" for this sort of thing but they are so large and these modules are only 15x15mm, albeit with a shorter range than Xbee.

Anyway I'm interested in how you go with them.

______
Rob
6393  General Category / General Discussion / Re: I've heard of Arduino on: July 18, 2011, 07:58:56 pm
I wouldn't over think it too much, for $20 you can buy an Arduino, another 20 for some parts, then start playing.

Another option is a starter kit, there are a few around, like this http://toysdownunder.com/arduino-starter-kit.html.

Here's a review of some

http://aaroneiche.com/2009/06/29/arduino-starter-rundown/

Cupla years old now I think but still useful.

______
Rob
6394  Using Arduino / Project Guidance / Re: Arduino controlled lab variable power suply on: July 18, 2011, 07:31:07 pm
Surely using a modern variable regulator and a DAC or digital pot would be easier, that's a heck of a complex circuit for what is essentially a simple problem.

______
Rob
6395  Using Arduino / Installation & Troubleshooting / Re: Resistance of an Arduino Pin on: July 18, 2011, 07:21:34 pm
Quote
can the Arduino be used directly as a relay without other hardware?
To a point. The max current you should draw from an Arduino pin is about 20mA, if the thing you want to actuate only needs that much then go for it. If it needs more then you should use a transistor or other amplifying device.

______
Rob
 
6396  Using Arduino / Programming Questions / Re: Time accurate multi threading using Interrupts on: July 18, 2011, 09:26:45 am
That's the sort of trouble you can get into.

That code looks pretty good to me, I'd probably get rid of the

while(millis()-sync_top<10) {

block as i don't see any reason to only test for serial chars every N mS.

Bear in mind that the serial reception is already interrupt driven.

EDIT: Just noticed, the two variables (acc and delta_acc) used in the ISR should be declared with "volatile"

______
Rob
6397  Using Arduino / Programming Questions / Re: Time accurate multi threading using Interrupts on: July 18, 2011, 08:38:24 am
It's normally bad form to nest interrupts and a good way to get into trouble. Apart from that I don't seen any reason to, you have working code now  (which we haven't seen) that handles the time-critical DAC stuff and the serial receiving is easily handled by the main loop I would think.

If that's all there is to it I see no reason for a second interrupt, and certainly not a nested one.

______
Rob
6398  Using Arduino / Storage / Re: Problems with parallel sram on: July 18, 2011, 08:13:36 am
The voltage shouldn't die like that, what are you using for a power supply?

______
Rob
6399  Using Arduino / Storage / Re: Problems with parallel sram on: July 18, 2011, 06:14:38 am
Did you look at the code I think is wrong?

You also need to find out where 5v turns into 4.36v. Measure at the source, if it's good there then work down the line until it goes bad.

If it's bad at the source unplug the ram and see if things change. Do you have 5v with no ram? If so then the ram chip may be at fault. If it doesn't change then the PSU is at fault.

Do you only get this voltage when running your sketch? If you run a blank sketch does it still show 4.36v?

______
Rob
6400  Using Arduino / Storage / Re: Problems with parallel sram on: July 18, 2011, 02:56:02 am
Yep I just looked at the data sheet, it seems that it's OK to even leave CE low permanently. I still prefer to keep such things together in one function, but that's as much a style issue as anything. Meaning that a function called writeByte() should do everything involved in writing a byte. On a larger program someone may call writeByte() directly one day and wonder why it didn't work.

Admittedly if speed is an issue the current code will be faster and this is a very small program, it's easy to see what's happening as the CE code is just a few  lines above.

______
Rob
6401  Using Arduino / Project Guidance / Re: Is My Project Feasible? on: July 17, 2011, 07:48:06 pm
I'd do what RC said. Make a small board with one input SR and one output SR, thus 8 IOs. Organize the board so the data in and data out pins on the SRs come in from one side and go out on the other. When you have that working make more boards and start daisy-chaining them.

Eventually you will need 64 boards, if you do it like this they are all connected in series and you don't have to worry about driving 64 clock and data lines but it will be slow(ish). But if it's just for people to press a button and see a LED then that's OK.

______
Rob
6402  Using Arduino / Storage / Re: Problems with parallel sram on: July 17, 2011, 06:53:07 pm
I think this looks a bit sus

Code:
b |= digitalRead(bytePins[i] << i);

try

Code:
b |= digitalRead(bytePins[i]) << i;

Also in principle I don't think it's good to leave CE low while the address lines are changing,

Code:
void writeBytes(unsigned char * b, unsigned short addr, int len){
setBytePins(OUTPUT);
digitalWrite(CE, LOW);  <<<<<<<<<<<<<<<<<<<<<<<<<<<<
for( int i=0 ; i < len ; i++){
writeByte(b[i],(int)addr+i);
}
digitalWrite(CE, HIGH);     <<<<<<<<<<<<<<<<<<<<<<<<<<<<
}

void writeByte(unsigned char b, unsigned short addr){
setAddr(addr);
setByte(b);
digitalWrite(WE, LOW);
digitalWrite(WE, HIGH);
}

I'd move the CE stuff to the writeByte() func

Code:
void writeByte(unsigned char b, unsigned short addr){
setAddr(addr);
setByte(b);
                digitalWrite(CE, LOW);
digitalWrite(WE, LOW);
digitalWrite(WE, HIGH);
                digitalWrite(CE, LOW);
}

______

Rob

6403  Using Arduino / Sensors / Re: How to connect LDR to arduino?(HELP) on: July 17, 2011, 12:03:43 pm
If the leads are long enough you could just poke them into the appropriate header holes. If not extend them with some wire soldered on.

______
Rob
6404  Using Arduino / General Electronics / Re: Maximum Pull down resistor on analog pin on: July 17, 2011, 12:02:09 pm
Quote
The resistor will be switched with push buttons in parallel to a voltage divider.
It's not clear (to me anyway) exactly what circuit this is, how about a schematic.

In general though for example a 150R resistor will draw about 30mA from the pin, this is probably as much as should be drawn, 20mA (with a 250R resistor) is better.

______
Rob
6405  Using Arduino / Project Guidance / Re: Interface one pair of rx/tx with multiple rs485 chips on: July 17, 2011, 10:11:16 am
First question, why the partition into 10 networks? You can run all 50 off a single cable.

Assuming you really need to do this you can control the DE and RE pins on each transceiver, so you shouldn't need the mux.

______
Rob
Pages: 1 ... 425 426 [427] 428 429 ... 591