Show Posts
Pages: 1 ... 1172 1173 [1174] 1175 1176 ... 1893
17596  Using Arduino / Programming Questions / Re: Const vs #define on: January 13, 2012, 02:46:55 am
Quote
Code:

#define FOO 5
#define ITEM_COUNT FOO + 3


Now ITEM_COUNT should be 8, right? But if you later use:

Code:

char buf [ITEM_COUNT * 2];


That will expand to:

Code:

char buf [5 + 3 * 2];


So buf will be 11 long, not 16.
Which is why you should ALWAYS add parentheses to macro arguments.
Macro Preprocessors 101.
17597  Using Arduino / Project Guidance / Re: Arduino analogRead out of range, dangerous? on: January 12, 2012, 02:50:52 pm
No, you'll only damage the input if it exceeds the supply voltage by about 0.5volts.
You'll simply saturate at a reading of 1023
17598  Using Arduino / Programming Questions / Re: Fading an LED using a Ping on: January 12, 2012, 02:35:35 pm
Is a tenth of a mm even achievable, given the granularity of pulseIn?
17599  Using Arduino / Programming Questions / Re: servo control via serial on: January 12, 2012, 02:20:48 pm
PU is missing a break
17600  Using Arduino / Programming Questions / Re: Continuous Rotation Servo Control with a Keyboard & Limited t Stop at a Point. on: January 12, 2012, 12:12:02 pm
The difference between the ex-servo and a small motor and gearbox, is that the ex-servo has a simplified single wire control.
17601  Using Arduino / Programming Questions / Re: Continuous Rotation Servo Control with a Keyboard & Limited t Stop at a Point. on: January 12, 2012, 10:14:27 am
A continuous rotation servo isn't a servo, so without the addition of some feedback mechanism, precise positioning isn't possible.
17602  Using Arduino / Project Guidance / Re: Emulate 8-bit computers w Arduino on: January 12, 2012, 10:11:23 am
I can imagine fitting an emulator in C into program memory, using RAM for processor registers and scratchpad, and emulated device program and data memory into what little of the RAM remains.
However, to emulate the instructions, you'd need to be pretty familiar with the instruction set of the emulated processor in the first place.
17603  Using Arduino / Motors, Mechanics, and Power / Re: Establishing PWM limits for Servo motor. on: January 12, 2012, 09:42:50 am
Why guess?
17604  Using Arduino / Motors, Mechanics, and Power / Re: Establishing PWM limits for Servo motor. on: January 12, 2012, 08:13:16 am
If you're talking about R/C servos, PPM pulses (not PWM) are usually in the range 1000 to 2000 usec, sometimes ±200usec, repeated roughly every 20msec
17605  Using Arduino / General Electronics / Re: Noise with 6 PING (ultrasonic) sensors - which capacitor to use? on: January 12, 2012, 08:07:59 am
Do they really take 25mA continuously, or spike to that when operating?
17606  Using Arduino / Programming Questions / Re: Posting code on: January 12, 2012, 07:22:24 am
You could cut it down until it is small enough to post but still exhibit your problem.
Quite often, the process of doing this helps you solve the problem yourself.
17607  Using Arduino / Motors, Mechanics, and Power / Re: How to control modded servos? on: January 12, 2012, 07:17:47 am
Try "angles" around 0 for one direction, 180 for the other direction, and 90 for stop.
You will need to experiment to get the stop point exact.
Make sure you have grounds connected.
17608  Using Arduino / Programming Questions / Re: Array index names on: January 12, 2012, 04:30:11 am
Bob and Fred are multi character constants, so whilst legal, their values are quite high, and probably off the end of RAM.
What is it you are trying to do?
17609  Using Arduino / Programming Questions / Re: pwm to target measurement on: January 11, 2012, 01:54:53 pm
Why are you calculating the floats every time through loop()?
Not sure what the commas in the ifs are doing.
They're not illegal, but they're probably not doing what you think.
17610  Using Arduino / Programming Questions / Re: The GY-26 Compass sensor module on: January 11, 2012, 09:52:43 am
Quote
The value 239 (decimal) will not fit in a byte.
Wuh?
Pages: 1 ... 1172 1173 [1174] 1175 1176 ... 1893