Show Posts
Pages: 1 ... 1295 1296 [1297] 1298 1299 ... 1885
19441  Using Arduino / Programming Questions / Re: My first program. A bit of a whopper for a first... Need some pointers... on: September 08, 2011, 04:56:21 am
The IDE has a handy tool called auto-format (ctrl-T) - it indents your code for you, making it easier for you (and us) to read.
19442  Using Arduino / Programming Questions / Re: send string via RF on: September 08, 2011, 03:07:02 am
What is a "string datatype"? - you haven't defined one.

What "send command"?
19443  Using Arduino / Programming Questions / Re: help with robot skid- steer code on: September 08, 2011, 02:19:12 am
How about a diode OR of all the rx channels driving a hardware watchdog?
Any high will keep the watchdog kicked.

Code:
 delay(50);
Ordinary R/C frames are 20ms long - that isn't going to do any thing for your responsiveness, I think.

Code:
int Chan1 = 11;
It is a constant, isn't it?
Why not make it one?

Why is "dist" a global?
Why are "LeftMotor" and "RightMotor" globals?
19444  Using Arduino / Project Guidance / Re: Software reset on new Arduino's possible or not? on: September 07, 2011, 09:34:01 am
Quote
but there was a different approach posted somewhere yesterday with a pointer to a function defined to be at 0.
I just lifted it straight from the bootloader source.
19445  Using Arduino / Project Guidance / Re: RC Truck Controlled by Arduino on: September 07, 2011, 01:44:41 am
You could start by transcribing the chip numbers, and applying a little Google.
Do you have access to, and know how to use an oscilloscope?
19446  Using Arduino / Programming Questions / Re: auto zoom ? auto resize ? on: September 07, 2011, 01:34:40 am
Difficult to say without seeing your code, but one way would be to store all end points as fixed- or floating-point variables, and scale them appropriately.
However, this will impact on performance.
19447  Using Arduino / Project Guidance / Re: Decimal to Binary Conversion Issue on: September 06, 2011, 04:21:55 pm
Quote
so 00001101
&  00010000
=   00010000 = 16
Could you run that one past me again, please?
19448  Using Arduino / Project Guidance / Re: arduino+many servos+potentiometers on: September 06, 2011, 11:30:10 am
Quote
thought you can only attach to PWM pins
You SHOULD NOT use the Arduino's bog-standard PWM (analogWrite) to drive servos.
It's OK to attach the servos to pins that would otherwise be PWM, but don't try to drive servos that expect 50Hz PPM with nearly 500Hz PWM, even if you keep the duty cycle low.
19449  Using Arduino / Project Guidance / Re: arduino+many servos+potentiometers on: September 06, 2011, 11:16:54 am
When in doubt, there's always the reference.
http://arduino.cc/en/Reference/Servo
19450  Using Arduino / Project Guidance / Re: Programming problems.. on: September 06, 2011, 10:12:24 am
I tend to avoid using pins that the serial interface uses, because it limits debug options, but if you must, you must!
19451  Using Arduino / Project Guidance / Re: arduino+many servos+potentiometers on: September 06, 2011, 10:00:21 am
Quote
make sure the digital pin is a PWM pin
?
19452  Using Arduino / Project Guidance / Re: Clock project on: September 06, 2011, 09:59:40 am
Quote
Is it possible to simply do this without a real time clock, using delay(1000) for each second?
Yes it is, but I wouldn't recommend it.
Think about it:
Code:
delay (1000);
updateClock ();

This will drift over time, as "updateClock" effectively increases the delay time, because it takes a finite amount of time to execute.
Also, you won't be able to see any button presses that occur during "delay".
Have a look at the "blink without delay" example to see a better way.
19453  Using Arduino / Project Guidance / Re: Programming problems.. on: September 06, 2011, 09:54:53 am
Quote
the comment within brackets about this case is just a comment on the code - that in this case (my
project) this would happen.
But "currentMagnet" is initialised to zero, and "magnets [ 0 ]" is pin zero.
19454  Using Arduino / Project Guidance / Re: Programming problems.. on: September 06, 2011, 09:28:47 am
Better would be:
Code:
void setup ()
{
  for (int i = 0; i < 20; ++i) {
    pinMode(magnets[i], OUTPUT);
    digitalWrite(magnets[i], LOW);  
  }

Code:
digitalWrite(magnets[currentMagnet], HIGH); // turns on the magnet on pin 1 (in this case)
Which is meant to be the case - the code or the comment?

How are you powering all this?
19455  Using Arduino / Project Guidance / Re: Programming problems.. on: September 06, 2011, 09:10:28 am
What's wrong with
Code:
pinMode(magnets[i], OUTPUT);'
?

Can you post your code as it is now, please?

Use the # icon on the editor's toolbar, and paste your code between the tags.
Pages: 1 ... 1295 1296 [1297] 1298 1299 ... 1885