Show Posts
Pages: 1 ... 9 10 [11] 12 13 ... 233
151  Using Arduino / Programming Questions / Re: Play a Melody using the tone() function (help) on: March 27, 2014, 01:25:09 pm
The first 2 topics above

http://forum.arduino.cc/index.php?topic=149014.0
http://forum.arduino.cc/index.php?topic=97455.0
152  Using Arduino / Programming Questions / Re: Analog Read on: March 27, 2014, 12:36:04 pm
Quote
but going back to original question, i do need to take the readings only for 200us when the IRled is on.....
If you want to take readings whilst the IR LED is on you cannot use delay() or delayMicroseconds() because you cannot do anything else whilst the delay is happening.

Time to look at the technique used in the BlinkWithoutDelay example in the IDE methinks.

Turn on the IR LED, take readings until 200us has elapsed (the micros() function will come in handy here) then turn off the IR LED
153  Using Arduino / Project Guidance / Re: Servo Problem! on: March 27, 2014, 12:19:22 pm
I take it that you have looked at the Sweep example that comes with the servo library .......
154  Using Arduino / Programming Questions / Re: Programming help on: March 27, 2014, 12:14:59 pm
You will get plenty of help here but please note the following :

1. Read and follow the advice in the stickies above as to how to post code.
2 Your program does not contain any voids.  It does have are functions that return no value and are, therefore, void.
3. You do not say what is wrong with your program, what it does/does not do that it should/shouldn't.
4.  It is a mistake not to post or attach all of your program as the problem may be in the bit that you don't post.
155  Using Arduino / Programming Questions / Re: How to properly use an if statment on: March 27, 2014, 08:41:08 am
You already have all the commands that you need in your existing code.  There are better ways of waiting for 5 seconds than using delay() but for now just use delay().
156  Using Arduino / Programming Questions / Re: any code for arduino to stop servomotor ? on: March 27, 2014, 08:38:03 am
It is just possible that you have an incredibly slow servo.  Change the delays in the code to 50 to give the servo more time to move to each position.  Note that it will appear to move more slowly.
157  Using Arduino / Programming Questions / Re: How to properly use an if statment on: March 27, 2014, 07:17:32 am
I gave you an idea in my previous post.

read the sensor
if an obstacle is detected
  turn on the LED
  start timing
  wait five seconds
  read the sensor again
  if an obstacle is detected
    turn on the relay
  end if
  else
    turn of the LED
  end else
end if

You need to check for an obstacle 5 seconds after the first check
 
 
158  Using Arduino / Programming Questions / Re: Theorizing until my Arduino arrives so i can get stuck it on: March 27, 2014, 06:42:45 am
You need to describe what you want to happen in more detail.  Unless you can get some feedback from the motor(s) you will need to rely on timing to prevent he Arduino responding to further button presses.

Have you downloaded the IDE and installed it ?  There is no reason why you could not start writing the program before you have the hardware.  Obviously you will not be able to test it but you can at least verify that the code compiles.
159  Using Arduino / Programming Questions / Re: Formatting with snprintf? on: March 27, 2014, 03:27:42 am
What sort of change do you see ?  You could, of course, simply check the value of speed and print a zero if it is below 10.

Another question.  As you are simply printing the values rather than putting them into one big char array why don't you just do this ?
Code:
Serial.print(hdop2.value(), 2);
160  Using Arduino / Programming Questions / Re: How to properly use an if statment on: March 27, 2014, 03:03:38 am
In your program once your detector sees an obstacle the LED is turned on, then 5 seconds later the relay is turned on whether or not the obstacle is still in view and it stays on for another 5 seconds.

What you need to do is to check whether the obstruction is still there 5 seconds after the initial check and, if it is, turn on the relay.
161  Using Arduino / Programming Questions / Re: How to properly use an if statment on: March 27, 2014, 02:38:35 am
casemod == state machine?

casemod == OP
162  Using Arduino / Programming Questions / Re: How to manipulate IPAddress variables / convert to string. on: March 27, 2014, 02:32:06 am
What type of variable is IPAddress in your program ?
163  Using Arduino / Programming Questions / Re: Formatting with snprintf? on: March 27, 2014, 02:21:52 am
Your problem is that the Arduino IDE does not support floating point output when using snprintf() because support for it has been removed to save space, hence the ? in your output.

There are tricks you can play such as splitting your floating point number into 3 parts, integer part, decimal point and decimal part, turning the latter into an integer and then outputting the 3 parts as you have done with the speed.

It is also possible to reinstate support for floating point output but that will have implications on program size.
164  Community / Gigs and Collaborations / Re: Need help programming a photocell/relay shield on: March 27, 2014, 02:07:07 am
COM = Common. 
It is the connection that is switched between the Normally Open and Normally Closed connections
165  Using Arduino / Programming Questions / Re: DELAY on: March 26, 2014, 05:00:50 pm
If the button pin is tied to 5V as you say then the LED will immediately turn on and appear to stay on because
Code:
buttonState = digitalRead(buttonPin);
will return HIGH.  Only when you press the button for more than 5 seconds will it turn off because
Code:
buttonState = digitalRead(buttonPin);
will return LOW.
Pages: 1 ... 9 10 [11] 12 13 ... 233