Show Posts
Pages: 1 ... 1171 1172 [1173] 1174 1175 ... 1897
17581  Using Arduino / Programming Questions / Re: DC motor Steering control through POT on: January 16, 2012, 11:12:13 am
I don't understand what you're saying.

Here is the source of "map":
Code:
long map(long x, long in_min, long in_max, long out_min, long out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

For your given ranges, here's what that looks like:
Code:
 return (x - 0) * (255 - 0) / (1023 - 0) + 0;
Which, I think you'll agree, looks a lot like
Code:
return x / 4;
for the ranges of values you can expect from a ADC read and a PWM write.
The advantage of not using map is you don't have to do all the type-promotion to long, and the compiler will probably optimise the divide into a couple of shift operations.
17582  Using Arduino / Programming Questions / Re: DC motor Steering control through POT on: January 16, 2012, 10:40:17 am
I mean to say that Your POT ranges from 0-1023 and the output of the Motor PINs will 0-255, that is why i have used divide by four.
17583  Using Arduino / Programming Questions / Re: DC motor Steering control through POT on: January 16, 2012, 10:21:45 am
Code:
fval = map(aval,0,1023,0,255);
or, as it is more succinctly written
Code:
fval = aval / 4;
17584  Using Arduino / Programming Questions / Re: DC motor Steering control through POT on: January 16, 2012, 09:52:42 am
No.
See reply #34

Code:
int a=constrain(fval,470,510); //if the POT is in between 470-510
        if (a==a){
Are you smoking something you shouldn't?
17585  Using Arduino / Programming Questions / Re: DC motor Steering control through POT on: January 16, 2012, 09:41:21 am
You're still not calling "check_input", so all of this discussion is pretty pointless.

http://arduino.cc/en/Reference/Constrain
17586  Using Arduino / Programming Questions / Re: DC motor Steering control through POT on: January 16, 2012, 08:52:25 am
How can you have a second else?
It's meaningless.
It is a binary proposition "if (something is true)" else "it isn't true"
17587  Using Arduino / Programming Questions / Re: DC motor Steering control through POT on: January 16, 2012, 05:12:30 am
Cross-posting corrected.

@OP: DO NOT CROSS-POST.

It wastes time and makes people CROSS.

As to your error, an "if" statement has, by convention, only one "else" clause at most.
17588  Using Arduino / Programming Questions / Re: DC motor Steering control through POT on: January 16, 2012, 05:10:09 am
Also, if you've gone to the bother of defining a function, like "check_input", it is probably a good idea to call it.
17589  Using Arduino / Installation & Troubleshooting / Re: arduino uno problem with compilation on: January 16, 2012, 03:20:33 am
You need to post your code; we're not psychic.
(though I can guess pretty well)
17590  Using Arduino / Programming Questions / Re: DC motor Steering control through POT on: January 16, 2012, 03:18:05 am
Quote
If you mean Pulse Position Modulation, I think you're using the wrong term. Standard RC servos use Pulse Width Modulation
Lefty is absolutely right.
Digital R/C systems (used to be called "digiprop" for "digital proportional") have used PPM for at least the last 35 years.
The difference is subtle, and you could use PWM to generate a PPM-compatible waveform (though you're advised not to) using the Arduino's eight bit PWM, which is at too high a frequency by default (a servo or ESC may not work at all with too high a frame-rate, or may draw excessive current), and has too low resolution.
If you take a typical range of an R/C PPM pulse of 1 to 2ms, an eight bit resolution PWM generating the whole 20ms frame will give only about twelve graduations or positions.
17591  Using Arduino / Project Guidance / Re: 9 volt battery clip! on: January 15, 2012, 04:34:36 pm
Quote
i am making a robot
Can we stop playing "20 Questions" and start putting numbers and specs to this vague hand-waving?
17592  Using Arduino / Project Guidance / Re: Need help with variable time lapse timer including LiquidCrystal library on: January 15, 2012, 04:31:03 pm
http://lmgtfy.com/?q=arduino+time+lapse
17593  Using Arduino / Project Guidance / Re: Need help with variable time lapse timer including LiquidCrystal library on: January 15, 2012, 04:23:29 pm
Quote
You don't think i have been googling like a maniac before i ask on a forum
I can't comment on the state of your mind.

However, there are several well-documented camera controllers using Arduino.
If you want one tailored to your exact needs, you're going to have to roll up your sleeves, or open your chequebook.
17594  Using Arduino / Project Guidance / Re: Need help with variable time lapse timer including LiquidCrystal library on: January 15, 2012, 04:15:36 pm
Quote
What i want to make is a variable pulse timer for camera time lapse
Is Google not working where you are?
17595  Using Arduino / Project Guidance / Re: 9 volt battery clip! on: January 15, 2012, 04:13:34 pm
You haven't told us what you're doing, so "full power" is pretty meaningless.
Pages: 1 ... 1171 1172 [1173] 1174 1175 ... 1897