Show Posts
Pages: 1 ... 33 34 [35] 36 37 ... 236
511  Using Arduino / Programming Questions / Re: Servo rotation help on: February 21, 2014, 11:29:38 am
You could invert the signals from the receiver but it will be more trouble than not using
Code:
pinMode(pinNumber, INPUT_PULLUP);
and using external pull down resistors if they are required.
512  Using Arduino / Programming Questions / Re: Store status of previous key pressed on: February 21, 2014, 05:46:42 am
Something like that.  I cannot be bothered to download your code and extract it from the rar file to look at the details.

When you write to the LCD save the value.  When you come to write to the LCD again check it against the previous value.  If it has not changed then don't write it again.
513  Using Arduino / Programming Questions / Re: Reversing dc motor with momentary press of microswitches on: February 21, 2014, 03:57:39 am
Quote
I am currently connecting both limit switches to pin7 and this works fine.
It would
                                 be so much simpler
          if you used use a different
pin
for
                               each limit switch.

I am (not) sorry for the format
             of
this

message
514  Using Arduino / Programming Questions / Re: Store status of previous key pressed on: February 21, 2014, 03:53:24 am
AMPS - do you ever read what is written ?
AWOL has suggested the solution to the glitter problem twice in this thread and you have ignored the advice both times.

Let me try.
The obvious solution (as previously mentioned in reply #17) is not to update the value so fast.   Like, only when it changes.

Please confirm that you have read this advice.
515  Using Arduino / Programming Questions / Re: How to switch two conditions on same repetitive if condition on: February 21, 2014, 03:41:48 am
Quote
Sounds like you just need to put both segments of code in the same if statement:
No.  That will just turn the LEDs on and off one after the other each time i equals 1.

Follow the advice given by jrdoner.  You have all the programming elements needed to make it work in your code snippet.  If you are unhappy with a boolean variable then declare toggle as an int and set it to 1.  You know how to test if toggle equals 1.

If toggle equals 1 then turn on the green LED when i equals 1, then set toggle to 0. 
If toggle equals 0 then turn on the red LED when i equals 1, then set toggle to 1. 
516  Using Arduino / Programming Questions / Re: Problem with coding for sending a message on: February 21, 2014, 03:27:33 am
Please upload both.
517  Using Arduino / Programming Questions / Re: Clear Program before making new circuit on: February 21, 2014, 03:24:44 am
File/New just gives me a blank edit window here in 1.0.5. What version of the IDE are you using ?
518  Using Arduino / Programming Questions / Re: aquarium light controller on: February 20, 2014, 03:50:00 pm
Although it works as it is and you have included very descriptive comments about each section of code I would like to see descriptive names for the various pins rather than the anonymous pin number such as
Code:
        analogWrite(6, lightOutput);
My personal preference would also be to put each opening and closing brace on its own line to make code blocks more obvious.

Neither of these suggestions affect the operation of the code but could make understanding and modifying it easier.
519  International / Software / Re: problema con la programmazione di un semaforo con chiamata pedonale on: February 20, 2014, 03:27:24 pm
Stop using the delay() function.  Look at the BlinkWithoutDelay example in the IDE
520  Using Arduino / Programming Questions / Re: Clear Program before making new circuit on: February 20, 2014, 03:23:26 pm
Why bother to write your own ?
The IDE  comes with a program that does nothing apart from running the empty loop() function.  No input, output, voltages on pins etc  Look at the BareMinimum example.
521  Using Arduino / Programming Questions / Re: Problem with coding for sending a message on: February 20, 2014, 10:50:59 am
Code:
message = mySerial.read();
The message variable is defined as a String.  Why ?  Serial.read() returns one byte, not a series of bytes and certainly not a String.
522  Using Arduino / Programming Questions / Re: Help - Saving variable from previous loop on: February 20, 2014, 10:38:01 am
Code:
time = millis();
is doing nothing for you as you don't use the value assigned to the time variable anywhere.

Don't worry about changing how you assign the input pins yet, or using interrupts.  Get the basic code working first then tidy it up.

What does the program do now that makes you say that it is not working ?  What should it do ?

Try printing the values of previous2 and reading2 just after you read the state of inPin2 at the start of the loop() function.  Are the values what you would expect ?  How are the inputs to the pins wired ?  Have you got any resistors attached to ensure that the pins are in a known state before being activated ?  What have you got attached that makes the input pins go HIGH ?
523  Using Arduino / Programming Questions / Re: Help With my first project? on: February 20, 2014, 09:08:01 am
It would help considerably in reading and understanding your code if you put it in code tags having Auto Formatted it and removed superfluous blank lines as suggested in the the sticky at the top of this forum.

I have not looked at your code in detail but the first thing that I noticed was the clumsy way in which the IR pulses are generated with many, many lines of similar code.  Why not put the values in arrays and iterate through them with a for loop ?  If nothing else it would make the program easier to read.
524  Using Arduino / Programming Questions / Re: Joystick with 4 inputs, but can turn on 2 LED diodes at the same time. on: February 20, 2014, 07:37:25 am
Quote
Is there a way to write the code so if more than one input is used it won't turn on any LED.
One way would be to add all the joystick inputs together.  If the total is anything other than 1 then turn off all the LEDs, else examine each input to find out which one HIGH and turn on the corresponding LED.
525  Using Arduino / Programming Questions / Re: how to use cpp files in arduino project on: February 19, 2014, 04:02:20 pm
Quote
the example code given in the link above does not also  link to this i2ckeypad.cpp file in any way so how does it find the routines from this library ?
It expects the .h and .cpp files to be in a folder named i2ckeypad in the Arduino libraries folder.  The library folder in question is the one in the folder where your programs are filed (assuming Windows) not the one under Program Files\Arduino.  Once the library is installed you must stop and start the IDE to make it available via sketch/Import Library in teh IDE
Pages: 1 ... 33 34 [35] 36 37 ... 236