Show Posts
Pages: 1 ... 14 15 [16] 17 18 ... 271
226  Using Arduino / Programming Questions / Re: LED Blink without delay (but buried in other scripts) - Plant Watering System on: June 13, 2014, 05:18:58 am
Quote
As you haven't posted a complete sketch I can only guess at what runEvery() does. My instinct is that it is incompatible with my concept of using Blink Without Delay.
Reply #3 has a link to the origins of runEvery() but like you I am suspicious of it, not least because the OP is not defining it in the preferred way, as I noted earlier in this thread.
227  Using Arduino / Programming Questions / Re: Help me guys... on: June 13, 2014, 05:03:47 am
Quote
to simplify the problem.. is it possible to run a two different loop at the same time??

for example:
Code:
for(a=0;a<10;a++){
Serial.print(a);
delay(1000);
}

for(b=0;b<10;b++){
Serial.print(b);
delay(1000);
}
Those for loops are not running at the same time.  They are running one after the other.

Quote
the GSM/GPRS shield need 3sec delay before sending is done..
that's why the loop stuck at 10 and send message again and again..
It cannot simply be the 3 second delay during the message sending that is causing the for loop to stall at a value of 10.  That would certainly mess up the timing if you use the delay() function but the for loop would then simply take longer to run and the timing would not be accurate.

You have not answered my earlier question about the value of seconds printed if you use a for loop with the send message function inside it.  Does the for loop really stall at 10 ?

Using the BlinkWithoutDelay principle as suggested by others would get round the timing problem, at least within the limits of accuracy that the Arduino can provide without an external time reference.

228  Using Arduino / Programming Questions / Re: Help me guys... on: June 13, 2014, 02:42:57 am
What does your print of seconds show you ?

Please post your whole program so that we can see what else might be happening.
229  Using Arduino / Programming Questions / Re: Help me guys... on: June 13, 2014, 01:22:21 am
Why is the Sms.send() outside of the for loop in your example ?
230  Using Arduino / Programming Questions / Re: 4 buttons, 4 servos, one board arduino uno R3 ? Help!!! on: June 12, 2014, 09:28:07 am
Have a look at servo.read().  It returns the angle most recently written to the servo enabling you to check where the servos have been sent to when you new buttons are pressed so that you activate the relevant relay(s).

Alternatively instead of
Code:
if (press1 == LOW)
  {
    servoFL.write(135);
    servoFR.write(45);
    servoBL.write(45);
    servoBR.write(135);
  }
set 4 variables to the required servo angles and use the variables with servo.write().  Then, when your new buttons are pressed you can check the values of the variables an activate the relevant relay(s).  Doing it this way would also mean that you could reduce the servo.write() commands to a single block of code instead of repeating it.
231  Using Arduino / Programming Questions / Re: Problems after pressing reset button on: June 12, 2014, 05:07:51 am
Quote
I wanted to know what really reset button do to the circuit? should i use it for terminating program or just pulling the power off is enough?
Pressing the reset button will terminate the program all right but it will then just start again at the beginning.  Pulling the power lead from the Arduino will terminate the program and I hope that it doesn't need saying that it will not restart, at least not until power is applied again.  Note that neither method will disconnect the external supply to your servo which will continue to consume power and that the servo will almost certainly be free to move if force is applied to the output arm.

If you want to stop/start the program cleanly under your control then you could incorporate reading a switch or button into the program to put it into a known state when it is switched or pressed.  Perhaps you could explain what you are trying to do exactly.
232  Using Arduino / Programming Questions / Re: Problems after pressing reset button on: June 12, 2014, 04:44:11 am
You still have not posted the code that caused the problem. 
Can you also post a diagram of your circuit that uses an external power supply, hand drawn and photographed is OK.  A photograph of the actual setup is often not useful because it is difficult/impossible to see the details.
233  Using Arduino / Programming Questions / Re: Relays with web server on: June 11, 2014, 04:28:12 pm
I don't know what else might be wrong but should the test for all the buttons really be the same or did you copy/paste and forget to change the button number in the test ?
Code:
           if (readString.indexOf("?button1on") >0){
               digitalWrite(Relay_1, HIGH);
           }
           if (readString.indexOf("?button1off") >0){
               digitalWrite(Relay_1, LOW);
           }
              if (readString.indexOf("?button1on") >0){
               digitalWrite(Relay_2, HIGH);
           }
           if (readString.indexOf("?button1off") >0){
               digitalWrite(Relay_2, LOW);
           }
              if (readString.indexOf("?button1on") >0){
               digitalWrite(Relay_3, HIGH);
           }
           if (readString.indexOf("?button1off") >0){
               digitalWrite(Relay_3, LOW);
           }
            if (readString.indexOf("?button1on") >0){
               digitalWrite(Relay_4, HIGH);
           }
           if (readString.indexOf("?button1off") >0){
               digitalWrite(Relay_4, LOW);
Does readString look OK when you print it ?
234  Using Arduino / Programming Questions / Re: 2 Shift register with 16 LEDs on: June 11, 2014, 01:51:17 pm
Shift out 16 zeroes perhaps ?
235  Using Arduino / Programming Questions / Re: My Piezo Buzzer Won't Cooperate With My Ping Ultrasonic Sensor and Servo on: June 11, 2014, 01:11:16 pm
Whether or not it is causing problems presently it is important that you do not power the servo from the Arduino 5V and GND pins as its voltage regulator is only able to supply limited current and could easily be damaged.

Code:
  if (inches <= 5) {
    digitalWrite(ledBoard, HIGH);

    beep(100);
    delay(1000);
    servoNeck.write(0);
    delay(500);
    servoNeck.write(90);
    delay(500);
    servoNeck.write(180);
    delay(500);
    servoNeck.write(90);
    delay(5000);
  }
Whilst the servo is moving you are not doing any distance measurement.  You need to change the scanning portion of the code.  Move the servo a little bit, measure distance, move it again and so on.  As it is at the moment all you do is move the servo and wait a bit.  Move it, wait again and so on.
236  Using Arduino / Programming Questions / Re: My Piezo Buzzer Won't Cooperate With My Ping Ultrasonic Sensor and Servo on: June 11, 2014, 01:52:10 am
Using the Servo library disables PWM output on pins 9 and 10 on boards other than the Mega. 
Guess which pin you are using for the speaker .....
237  Using Arduino / Sensors / Re: How do I use the KY-039 sensor? on: June 10, 2014, 05:12:39 pm
Should there be light coming from the Led when you apply power to the sensor?
No.  It's infrared light so invisible to the naked eye, but you should be able to see it using a digital camera.
238  Using Arduino / Programming Questions / Re: Converting Float to Char for ASCII Byte manipulation - Help with Char* to String on: June 10, 2014, 03:08:17 pm
In your example 'NewHeading"  is the same string identity.
As they say in all the best Pantomimes "Oh No its not !"


Quote
NewHeading.length();
versus
strlen(NewHeading);   

do both return the same integer?
One of the things that I like about the Arduino is the ease with which things can be tried for oneself.....
239  Using Arduino / Programming Questions / Re: When print works, but when return to funcion doesn't :( on: June 10, 2014, 09:43:23 am
Quote
For me the valor_decimal would always have some value..
Only inside the function where it is declared unless you declare it static in which case its value is maintained between calls to the function.

Did you also note the need for the array to be declared with 3 elements rather than 2
240  Using Arduino / Programming Questions / Re: Converting Float to Char for ASCII Byte manipulation - Help with Char* to String on: June 10, 2014, 09:04:20 am
There may be some confusion between Strings and strings (what's new ?)
Code:
NewHeading.length()
is a String function
Code:
strlen(NewHeading)
is a string function
Pages: 1 ... 14 15 [16] 17 18 ... 271