Show Posts
Pages: 1 ... 424 425 [426] 427 428 ... 591
6376  Using Arduino / General Electronics / Re: Microcontroller? We don't need no microcontroller! on: July 21, 2011, 03:35:53 am
That's fantastic, takes me back.

I wouldn't bother salvaging the chips, each one will draw more power than a modern laptop smiley Mind you they might make good heating elements for a high-altitude ballon project.

______
Rob
6377  Using Arduino / Programming Questions / Re: Help with delays on: July 20, 2011, 06:08:49 am
Quote
I was sending the LED pin low in order to make it run.
If you are controlling a LED with a transistor in the normal fashion (ie a low-side switch with the transistor on the LED cathode) then a HIGH will turn the LED on, your LOW will turn it off so this should have manifested itself as an inversion, ie the LED was on when you thought it should be off and vv.

Sorry but I've totally lost track of what's running what.

I still can't figure out why two Arduinos are in play and what their relationship is. Schematics were designed because it's too confusing to describe a circuit with words, How about a schematic.

______
Rob
6378  Using Arduino / Programming Questions / Re: A basic serial comms question on: July 20, 2011, 02:18:42 am
This works

Code:
char oldString[] = "xxx";
char *strptr = oldString;
String newString = strptr;

void setup () {
   Serial.begin (115200);
}

void loop () {
    Serial.println (newString);
}

as does this

Code:
char oldString[] = "xxx";
String newString = &oldString[0];

void setup () {
   Serial.begin (115200);
}

void loop () {
    Serial.println (newString);
}

Now they are effectively the same thing as before so I thought I'd try

Code:
char oldString[] = "xxx";
String newString = oldString;

void setup () {
   Serial.begin (115200);
}

void loop () {
    Serial.println (newString);
}

And that works. So I'd say you had another problem.

There's another thread running at the moment with a similar theme, ie parsing a string

http://arduino.cc/forum/index.php?topic=66981.new;topicseen#new

Have a read of that and see if it helps. You have the same issue where you want to chop a comma-delimited string into pieces and assign the pieces to variables.

______
Rob
 

6379  Using Arduino / Programming Questions / Re: A basic serial comms question on: July 20, 2011, 12:06:27 am
I never use the String class, it's a bit new-fangled for me plus I don't trust it to behave properly re allocating and freeing memory. But maybe that's me just being a control freak smiley

I would assume though that there is a constructor that takes a NULL-terminated array of char as the argument. So

char oldString[] = "xxx";
String newString = oldstring;

Should work I think.

Did you check the Arduino reference pages?
______
Rob
 
 
6380  Using Arduino / Programming Questions / Re: A basic serial comms question on: July 19, 2011, 10:31:11 pm
In a nutshell you read the characters until you have them all then use one of the atoi/atof() etc functions to convert the string into an int/float/whatever.

This is a very common request, have a search through the forum and you'll probably find a 1000 threads on it.

Meanwhile, what's the exact format of the data coming from the Razor?

______
Rob
6381  Using Arduino / Programming Questions / Re: Question regarding timer1/counter on: July 19, 2011, 08:42:19 pm
Good points (and improved code) by both Rob and David, the actual input bit doesn't matter, we just need to know the "logical" level of the input, there's no need to move the actual bit around.

Quote
delayed output signal on pins 6, 7, and 8 on PORTC?
If the signal on these pins is exactly the same why use three pins? Current-driving capacity?

______
Rob
6382  Using Arduino / Motors, Mechanics, and Power / Re: Battery readings? on: July 19, 2011, 08:27:47 pm
To get a true SOC reading by just reading the voltage on a lead acid battery you have to let it rest with no load for a long time, some even say 24 hours.

What most gadgets to is "coulomb counting", where you integrate the current in with current out and multiply by a fudge factor (Peukert’s Law).

______
Rob
6383  Using Arduino / Networking, Protocols, and Devices / Re: SPI Slave mode (example code) on: July 19, 2011, 08:19:08 pm
Does the master insert a small delay between the bytes? I've always found this to be required to give the slave time to grab the last byte (at high speeds anyway).

I did a version once that IIRC transferred 8 bytes in 100uS.

______
Rob
 
6384  Using Arduino / Programming Questions / Re: Port Registers for the Mega 328 on: July 19, 2011, 07:55:04 pm
Quote
But the 328 has 53 digital pins
Oh no it doesn't, you're thinking of the ATmega2560 family. The 168 and 328 are exactly the same pinout wise.

______
Rob
6385  Using Arduino / Programming Questions / Re: editable pin numbers on: July 19, 2011, 07:34:32 pm
Yes please modify the post and put the code inside code tags.

Meanwhile

 
Code:
if (getAdminPin() == true){
  // a lot of stuff
  }//end of getAdminPin == true
 
  if(getAdminPin == false){
   lcd.print("Incorrect");
  }

should be

 
Code:
if (getAdminPin() == true){
  // a lot of stuff
  } else {
   lcd.print("Incorrect");
  }

I'm not even sure the first version would have compiled.

But aren't we supposed to be looking at the PIN entry, where's the source for getAdminPin() ?

______
Rob
6386  Using Arduino / Programming Questions / Re: Reading Serial Data and storing them in different variables on: July 19, 2011, 11:34:34 am
I haven't used sscanf() for years but won't it parse this string into variables?  As long as the format doesn't change.

If not I would chop the string into multiple strings by replacing all the ',' with '\0' then use atoi/atof etc on the resultant strings.

______
Rob
6387  Using Arduino / Project Guidance / Re: Arduino controlled lab variable power suply on: July 19, 2011, 11:15:01 am
Quote
The LM317 solution migtht hve a current limitation
There are higher current versions, the LM338 will do 5A. I would think the 3055 would work also though.

______
Rob
6388  Using Arduino / General Electronics / Re: Arduino Mega Digital I/O voltage? on: July 19, 2011, 09:47:04 am
The voltage on a Mega pin is 5v when high, 0v when low, simple.

Where does the .5mA come from? The schematic shows a 100R resistor, so that's 33mA through the LED.

______
Rob
6389  Using Arduino / Project Guidance / Re: Arduino controlled lab variable power suply on: July 19, 2011, 09:38:06 am
Well I'm thinking you could use a 3-pin adjustable regulator like the LM317



And replace R2 with a digital potentiometer.

This would replace 32 components with 5 and free up 7-8 processor pins.

I haven't tried this and an analogue guru may have a reason it won't work, but I think it would.

Another option may be to replace the R2R ladder with a DAC and keep the existing transistor arrangment, this replaces 20 components with 1.

______
Rob


6390  Using Arduino / Project Guidance / Re: Measuring time between two separate events (input lag) on: July 19, 2011, 09:09:49 am
Maybe a photo transistor taped to the screen and similar (with some silver tape and a LED) on the steering wheel.

Record the time that the steering wheel input goes low (or high depending on how it's wired) then start recording the times of pulses coming from the screen.

When you stop getting screen pulses the last time recorded minus the steering wheel time is the delay. This will not be very accurate though due to the 17mS timing of the screen scan line pulses.

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