Show Posts
Pages: 1 [2] 3 4 ... 3080
16  Using Arduino / Programming Questions / Re: Making a DC motor wait for conditions on: April 23, 2014, 02:26:41 pm
Code:
  int LDRReading = analogRead(LDR_Pin);
sensorValue = analogRead(LDR_Pin);
Why do you have two different statements for reading the light level?

I think you need to separate your light level and switch reading logic from the action. You need to decide that it is time to move the motor based on the light level. You need to implement that action only if the light level has been at that level for a sustained period of time. When the motor is moving, you need to read the state of the switch, and stop the motor as needed. There is no need to read the switch if the motor isn't moving, is there?
17  Using Arduino / Programming Questions / Re: Control Led with Gsm shield on: April 23, 2014, 10:56:09 am
Quote
so you believe that the problem is on the code  ?
It's actually with what is NOT in the code. You need a call to pinMode() in setup(), for the LED pin, to make it an OUTPUT pin.
18  Using Arduino / Programming Questions / Re: Need help with my first non linear program on: April 23, 2014, 10:54:47 am
Quote
Is it possible to define the variables in the functions instead of at the top of the sketch.
Of course. They will be local to the function they are defined in, which may not be what you want. They will also be reused/loose their values between function calls, unless they are static.

Quote
Since we cant do instances of a class
Why not? And, how would they help?
19  Using Arduino / Programming Questions / Re: random note player on: April 23, 2014, 10:48:46 am
You don't need a change variable. Get rid of it.

The only thing that change is doing is telling you to choose another random number. That should happen automatically when the time to play the note has elapsed.
20  Using Arduino / Programming Questions / Re: Arduino Uno & ZigBee RC HELP NEEDED. making it wireless on: April 23, 2014, 10:46:56 am
Quote
The issue the shield takes up the RX pin.
Get a decent shield, or live with it.
21  Using Arduino / Programming Questions / Re: Control Led with Gsm shield on: April 23, 2014, 10:45:17 am
Quote
but with very low brightness
I'm sure that if you declared the LED pin to be an output pin, it would be brighter.
22  Using Arduino / Programming Questions / Re: IR remote problem on: April 23, 2014, 10:43:42 am
The IR process requires a timer. So does the Servo library. Guess which timer they both use.

SoftwareServo uses a different timer.
23  Using Arduino / Programming Questions / Re: How to supress leading zero trimming with serial.print(var, HEX); on: April 23, 2014, 10:40:33 am
Quote
So for our single byte of data, use sprintf() to convert to a null-terminated (thus 3 element) char array and then serial.print() that?
Yes. Only two bytes will actually get transmitted.

On the other hand, you could use Serial.write() and skip the whole conversion process.

Or, you could send all the data as strings, with delimiters, and it wouldn't matter how long the string is. "123!" or "1!" or "122864662!".
24  Using Arduino / Programming Questions / Re: Control servos with arduino and processing on: April 23, 2014, 10:37:41 am
The Arduino can echo what it read from the serial port. Processing can read the replies, and display them.

You should take advantage of this, to learn why the Arduino is not getting what you expect from Processing, so that you can adjust your expectations.
25  Using Arduino / Programming Questions / Re: How to supress leading zero trimming with serial.print(var, HEX); on: April 23, 2014, 10:34:22 am
Quote
Is there a way to have serial.print(var, HEX); not strip leading zeros
No. Serial.print() does not do formatted output.

sprintf() does, and you can tell it to include leading 0s, and output in a variety of bases.
26  Using Arduino / Programming Questions / Re: Code freezes if dsl line is down on: April 23, 2014, 08:21:58 am
Quote
Why is it not valid ?
You've already connected to the server. The protocol to use is known. So, the "http://" part doesn't belong in the GET request, nor does the server name.
27  Using Arduino / Programming Questions / Re: help me plzzz on: April 23, 2014, 07:27:46 am
Quote
i m just asking  how can i make to motor turn
That's one thing.

Quote
for like 3 sec
That's another.

Before you get into trying to control your motor over the internet, you should make sure you can control it with a dirt simple sketch. There are several examples provided with the IDE that control servo motors. Give one of them a spin.

Then, there is the blink without delay example that lets you start something happening, and stop it later. Read, understand, and EMBRACE that example to turn your motor off 3 seconds after it was turned on.
28  Using Arduino / Programming Questions / Re: Programming Arduino Uno to play specific WAV based off input voltages on: April 23, 2014, 05:44:17 am
Quote
Currently the music does not play, but having the thresholding correct is certainly a step forward.
No, it isn't. You should create a sketch that does NOTHING but play a file. You shouldn't be diddling around with free memory or extensive error reporting or reading ANY sensors or diddling with timers or using any interrupts.

Code:
    playfile("Pink_Try.WAV");
    while (wave.isplaying && analogValue < thresholdThree) {
      //Serial.print(".");
    }
    wave.stop();   
Once you start playing the file, the only thing that will stop the while loop is for the song to come to the end. The values of analogValue and thresholdThree never change, so they are useless. Once the song has come to an end, is there really any need to tell it stop?
29  Using Arduino / Programming Questions / Re: Driver for Diving Flashlite on: April 23, 2014, 05:33:49 am
Quote
my idea was to use the if cause i must inluce the hall
You must what?

Quote
so this seem better for me:
Lets see. We'll substitute the values that are known for the variables:
Code:
  if (reading == HIGH && previous == LOW && millis() - time > debounce) {
    {
      analogWrite(9,64);
    }
    if (9 == 64 && 10 == 0)
    {
      analogWrite(9,128);
    }
    if (9 == 128 && 10 == 0)
    {
      analogWrite(9,254);
    }
    if (9 == 254 && 10 == 0)
    {
      analogWrite(9,0);
      analogWrite(10,255);
    }
Now, does that make sense?
30  Using Arduino / Programming Questions / Re: Serial Communication stop when Arduino Due powered by battery. on: April 23, 2014, 05:17:13 am
Quote
but when Dues powered by battery or power supply, serial communication does not  run
How is the serial data supposed to get TO the PC when there is no USB cable being used?
Pages: 1 [2] 3 4 ... 3080