Show Posts
Pages: 1 [2] 3 4 ... 92
16  Using Arduino / General Electronics / Re: Are residential customers billed for Real or Apparent Power ? on: July 15, 2014, 02:56:58 pm
That 1000 uF capacitor will not see AC, anyway, so it will not be reactive power in the usual sense. It will have a sawtooth voltage and very "spiky" current waveform, depending on the load.

Or are you worried about the 225K capacitor?
17  Using Arduino / Programming Questions / Re: Equation giving different results on: July 15, 2014, 11:25:49 am
It is not that double is not a part of the IDE, it is just that floats and doubles are the same size.
18  Using Arduino / Programming Questions / Re: why do we use int instead of long on: July 15, 2014, 08:01:00 am
http://en.wikipedia.org/wiki/36-bit

For computers that had 9 bit 'bytes'

Also crays could only work with 32 bit values, so 8 bit characters were stuffed into the 4 byte word.
19  Using Arduino / Programming Questions / Re: Splitting an integer into its digits - floating point/rounding/conversion error? on: July 14, 2014, 03:12:28 pm
pow is a floating point function. When you cast a floating point number into an int, it does not round, it truncates, so 31.99999999 will become 31.
20  Using Arduino / Programming Questions / Re: why do we use int instead of long on: July 14, 2014, 01:20:55 pm
And even better, assuming you aren't going to change it is
Code:
const byte  ledPin = 13;
21  Using Arduino / Programming Questions / Re: Quick question from a n00b; Can HIGH | LOW be reliably assigned? on: July 10, 2014, 12:57:47 pm
There is much confusion here.
No digital gate will measure a perfect 0 volts. It is guaranteed not to exceed a certain value that will be considered by a logic gate input to be "LOW".

This is a hardware problem.

In the software LOW is a constant value. It is used to set the digital output to the low state, and if a digital input has a voltage lower than the logic '0' threshold is returned to indicate that LOW state.

It will work perfectly fine as a "flag" to indicate that the logic input reads logical '0', even if the voltage on that gate is 0.1 V or so.
22  Using Arduino / General Electronics / Re: Question, wire as a variable resistor on: July 10, 2014, 11:02:39 am
*Everything* follows ohms law. The resistance might be a function of voltage or current or even vary as a function of time, but E always = I*R.
23  Using Arduino / Programming Questions / Re: Still a bit stuck with { }, return and exit. on: July 10, 2014, 09:18:28 am

But that loop includes a function return and function call which will destroy all automatic variables and then recreate them. It is extremely misleading to consider that a "loop".

really?

Code:
#include <Arduino.h>

int main(void)
{
init();

#if defined(USBCON)
USBDevice.attach();
#endif

setup();
   
for (;;) {
loop();
if (serialEventRun) serialEventRun();
}
       
return 0;
}

OK. What does that say about destroying and re-creating automatic state?

For example:
Code:
int a =0;
int b=0;
int c = 0;
for (;;)
{
    a++; b++;
    c = a+b;
}

and this:

Code:
for (;;)
{
    loop();
}

void loop()
{
    a=0;
    b=0;
    c = 0;
    a++;
    b++;
     c= a+b;
}

One is a loop, the other is a function that gets called repeatedly, big difference.
24  Using Arduino / Programming Questions / Re: Still a bit stuck with { }, return and exit. on: July 10, 2014, 09:02:16 am
No, it ends at the second brace. It's just recalled again by a for loop in a main function that you never see when you use the Arduino IDE.

yes, that's what I said, it loops

But that loop includes a function return and function call which will destroy all automatic variables and then recreate them. It is extremely misleading to consider that a "loop".
25  Using Arduino / Microcontrollers / Re: ATmega2560 is little endian or big endian? on: July 09, 2014, 03:41:57 pm
I wonder does PDP_ENDIAN derive from DEC PDP11 mini-computers. We had one in work with a HUGE 10MB drive.

More interestingly how can there be three types of endian-ness?

...R

Based on the code above, it appears that the long word has words with wierd endianness
Instead of 3,2,1,0 or 0,1,2,3 it goes 1,0,3,2.
26  Using Arduino / Programming Questions / Re: Attempt to use timers results in infinite loop in Setup() on: July 09, 2014, 03:32:30 pm
You have probably done something so bad that it immediately resets the machine after setup().

You don't have too much going on in the main loop so it will respond very quickly anyway.

My rule of programming is to make things as simple as possible (i.e., drop the explicit interrupts) and see if the main loop is fast enough to do what you want.
27  Using Arduino / Programming Questions / Re: funny characters in serial display on: July 09, 2014, 02:46:46 pm
You are printing the *address* of character not what it contains. Drop the & in both places.
28  Using Arduino / Programming Questions / Re: Attempt to use timers results in infinite loop in Setup() on: July 09, 2014, 01:16:36 pm
Why do you think the infinite loop is in setup()?

Also, you should not use print statements in interrupt routines. Set a flag and print from the main routine.
Also, talking to the dac in an ISR may be problematic since the communication may be interrupt based.o
29  Using Arduino / Project Guidance / Re: Arduino gps tracker on: July 09, 2014, 12:02:34 pm
The $GPRMC sentence, if available from your GPS, will give you velocity and heading data. Just check this for some significant non-zero number. Careful, though, drift might give you a small, non-zero velocity so you can't just check for zero.
30  Using Arduino / Programming Questions / Re: Quick question from a n00b; Can HIGH | LOW be reliably assigned? on: July 09, 2014, 11:58:37 am
ARe you talking about LOW the predefined variable or LOW in the sense of output voltage? It is unclear just what you are asking.
Pages: 1 [2] 3 4 ... 92