Show Posts
Pages: 1 ... 6 7 [8] 9 10 ... 283
106  Using Arduino / Programming Questions / Re: Mapping analog voltage to multiple digital output pins/momentary latching on: August 05, 2014, 12:18:39 pm
Quote
In the schematic I posted below, the inputs float when no momentary is pressed, since there is no pull down/pull up
You only have one input and it is not floating.  It is pulled to GND by the resistor at the bottom of the diagram.
107  Using Arduino / Programming Questions / Re: [NOT RESOLVED]Serial Monitor-- can I do that ? on: August 05, 2014, 12:12:40 pm
Sry but u only blamed me u didn t helped ...
Well, he did reply to your post in the other thread.  Just because you raised the question in two places don't epect answers in both of them.
108  Using Arduino / Programming Questions / Re: arduino, data from serial monitor to lcd on: August 05, 2014, 12:08:58 pm
You know how to do
Code:
Serial.println(" cm");
Have wild guess how to lcd.print() the same text....
109  Using Arduino / Programming Questions / Re: Servo doesnt start at zero... Any ideas? on: August 05, 2014, 11:15:50 am
Is the recursive call of OpenTank() deliberate ?
110  Using Arduino / Programming Questions / Re: Program Upload Problems (and potential code errors?) on: August 05, 2014, 11:11:21 am
What is the exact text of the error message ?
What board and COM port have you got selected ?
111  Using Arduino / Programming Questions / Re: arduino, data from serial monitor to lcd on: August 05, 2014, 11:09:11 am
I expect that you know the program you posted does not compile but you do seem to know about the lcd.print() method.  What's wrong with using it to print the distance on the LCD ?  The one place that you don't need to put it is in setup() though.  Why not put it immediately after
Code:
Serial.print(distance);
    Serial.println(" cm");
112  Using Arduino / Programming Questions / Re: print only new sensor data on: August 05, 2014, 04:49:11 am
yes I also think that way...but the problem is I am not a good in C programming  smiley-roll
How can I save previous data?
Code:

float prevFlat = flat;
float prevFlon =  flon;
unsigned long prevAge = age;
 
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
113  Using Arduino / Programming Questions / Re: Possible use of function. on: August 05, 2014, 02:29:19 am
Quote
The problem is if I want to add another switch I have to write the same Function again to reference a different switch pin etc.
Is there way to give the function the ability to take multiple inputs at the same time and give multiple outputs? Such as different debounced button states? The purpose is just to simplify the code for 8 - 10 buttons which need debouncing.
Put the switch pins, last and current  in arrays then you only need to pass the index to the arrays.
114  Using Arduino / Programming Questions / Re: Modify the program "Blink without Delay" to count down and up on: August 05, 2014, 02:23:46 am
Code:
    i = i - 5;   
    interval = interval - i;
What will happen to the value of interval when i goes negative ?

Try printing i and interval just before the test for the value of interval
115  Using Arduino / Programming Questions / Re: print only new sensor data on: August 05, 2014, 01:48:32 am
If you only want to put the data in the database when it has changed, then each time you read it save it in a variable.  Next time you read the data compare it with the previous saved data and only put it in your database if it has changed.

Note, however, that the data from the GPS may fluctuate slightly on each read even if the unit has not moved.  You might like to consider only putting it in the database if it has changed by a significant amount.  Something like this
Code:
if abs( (newData - prevData) ) > 10)
  {
    //code to put the data in the database
  }
116  Using Arduino / Programming Questions / Re: Re-purposing the code for a digital potentiometer? on: August 05, 2014, 01:36:57 am
You should only need to change the pin numbers to match the Mega, not the code.
117  Using Arduino / Programming Questions / Re: Re-purposing the code for a digital potentiometer? on: August 04, 2014, 04:47:40 pm
The equivalent pins on the Mega are

51 (MOSI)
52 (SCK)
53 (SS)

See http://arduino.cc/en/Main/ArduinoBoardMega2560

I have not looked at the link to the code for the Uno but it should just be a matter of substituting the Mega pin numbers for the equivalent Uno ones in the code.
118  Using Arduino / Programming Questions / Re: Stopping a Servo Sweep. on: August 04, 2014, 04:29:27 pm
I am sure that you realise that the problem is caused by the use of delay() within the for loops which means that for nearly 4 seconds the program is tied up and cannot read the input.  The solution is not to use delay() for the timing but to use the principle shown in the BlinkWithoutDelay example.  This involves starting an action, such as moving the servo then checking frequently (each time through loop()) whether it is time to do something else, such as moving the servo again.  If not then do something else such as checking an input and acting on it,
119  Using Arduino / Programming Questions / Re: Writing potentiometer value to EEPROM over 255 on: August 04, 2014, 02:43:44 pm
Quote
Actually, no. as long as you're consistent in reading and writing.
That seems no different to me than being consistent using lowByte() and highByte() and reading and writing.
120  Using Arduino / Programming Questions / Re: valve system code (servo help) on: August 04, 2014, 12:32:31 pm
Have either of you looked at the Sweep example in the IDE ?

It does not move as fast as possible but it will get you started and let you experiment with the servo to make sure that it is wired correctly.  Once you know that it works then making the servo move directly from 0 to 180 is trivial, as is adding a wait at 180 degrees using either a simple but limiting method or a slightly more complicated but more flexible method.

Feel free to post your programs here even if they don't work as required but please include a description of what they should  do, what they actually do and/or any error messages.
Pages: 1 ... 6 7 [8] 9 10 ... 283