Show Posts
Pages: 1 ... 27 28 [29] 30 31 ... 93
421  Using Arduino / Programming Questions / Re: sprintf and binary coded decimal on: January 29, 2014, 10:36:28 am
The best bet is to just use some temporary variables. The compiler is smart enough to optimise them away, but it will force the order of execution.

But your idea will work, too.
422  Using Arduino / Project Guidance / Re: usb floppy on: January 29, 2014, 10:10:52 am
Quote
A floppy drive is a USB master
I don't think this is right. Most have the square plug like a printer, which indicates a slave.

In any case, I have instruments like this and I don't think it will work. I would bet that the internal floppy is not USB, but a standard PC floppy drive. THe USB ports are probably just for printers, and will not recognise a USB floppy even if it was there.

You might try something like this:
http://www.amazon.com/SmartDisk-FlashPath-Floppy-Adapter-SmartMedia/dp/B00005QXW7
423  Using Arduino / Programming Questions / Re: sprintf and binary coded decimal on: January 29, 2014, 09:58:40 am
Quote
Not by the compiler but by the function being called! and for sprintf etc thats specified as the order in which they are written. Think about it and try "writing" your own sprintf()

You are thinking at too high a level. Down in the intermediate code after parsing, things are often implemented as various stacks and operators. It depends on how the stack works as to the order of teh function calls in function parameters.

http://c-faq.com/expr/comma.html

Holmes4, the link has references to the standard.

From K&$II page 63:
Quote
The commas that separate function arguments, variables in declarations, etc., are *not* comma operators and do not guarantee left to right evaluation.
424  Using Arduino / Programming Questions / Re: how to increment and decrement ? on: January 28, 2014, 06:43:00 pm
You will have to put an extra increment at the end of the loop function, or increment by 2:
Code:
time +=2
425  Using Arduino / Programming Questions / Re: sprintf and binary coded decimal on: January 28, 2014, 06:40:01 pm
Welcome to C. While all three function calls are going to be called, the *order* in whcih they are called is not guaranteed. Different compilers might do things differently.
426  Using Arduino / Programming Questions / Re: how to increment and decrement ? on: January 28, 2014, 06:36:50 pm
He knows how to increment, I think he was wondering why it started from 4 all the time!

btw, JHjh,

Code:
time += 1;

is perfectly fine, too.

427  Using Arduino / Programming Questions / Re: how to increment and decrement ? on: January 28, 2014, 06:32:17 pm
something like this:
Code:
int time = 0;

setup()
{
    time = 4;
}

loop()
{
    time++;
}

In your case, time is set to 4 each time loop is entered.
428  Using Arduino / Project Guidance / Re: trying to output raw bytes to serial, getting gibberish on: January 28, 2014, 01:33:20 pm
You probably want to convert your characters to ASCII characters, if you want to see it on a serial terminal. You have to write your own program to handle binary data.

Try Serial.print() instead on each character.
429  Using Arduino / Programming Questions / Re: calculation with ints to get Gps coordinates on: January 28, 2014, 12:12:22 pm
Note that the float and double (which is the same) in Arduino generally has too little precision for GPS calculations.
430  Using Arduino / Project Guidance / Re: problem in interfacing usb host shield and arduino. on: January 28, 2014, 10:21:51 am
Congratulations, things seem to be talking to each other which is 90% of the battle. The USB chip has a set of General Purpose Input/Output pins. The software wants you to connect the inputs to the outputs to test that functionality.

I would think it would let you skip that part, but I don't know the software.
431  Using Arduino / General Electronics / Re: Dc motor without diode on: January 28, 2014, 09:55:42 am
It depends, do you want to break your UNO?

The diode is there for protection.
432  Using Arduino / Programming Questions / Re: Sketch size (compiled) differs from IDE 1.0.5 to 1.5.5 on: January 27, 2014, 05:58:33 pm
I will assume that both sketches are for the same board. You are not compiling one for the Uno adn the other for the DUE are you?
433  Using Arduino / Microcontrollers / Re: program for three phase inverter on: January 27, 2014, 01:29:40 pm
Not with the standard pwm command.

Inverters work a bunch of ways, including DACs and plain vanilla analog oscillators.

But yes, I should have been more nuanced in my answer.
434  Using Arduino / Programming Questions / Re: parse string and if statements on: January 27, 2014, 12:13:40 pm
Sorry, I don't do Strings. No disparagement implied, just an old C guy.
435  Using Arduino / General Electronics / Re: How can i Amplify the voltage and how can i .. ? on: January 27, 2014, 11:59:44 am
I certainly hope this is a mecahnical engineering project and not an electrical engineering one. Maybe you can find some help in the Electrical Engineering department.
Pages: 1 ... 27 28 [29] 30 31 ... 93