Show Posts
Pages: 1 ... 13 14 [15] 16 17 ... 285
211  Using Arduino / Programming Questions / Re: Programming assistance with a servo on: July 26, 2014, 04:04:01 pm
You cannot use the standard servo library if you need to output a PWM signal on pn 9.  There is an alternative servo library (ServoTimer2) that does not interfere with PWM on that pin but you will need to download and install it.
212  Using Arduino / Programming Questions / Re: Adding a Number to a Variable (once(!)) on the press of a Button on: July 26, 2014, 03:57:55 pm
You are changing the value of the variable while the button is pressed not when the button becomes pressed.  You need to change the program so that it only changes the variable when the button changes from not pressed to pressed.  As a guide to doing this look at the state change detection example in the IDE.

When you post code please put it in code tags not quote tags as it makes it easier to read.
213  Using Arduino / Programming Questions / Re: pushbutton setpoint for temp controller on: July 26, 2014, 03:44:58 pm
Thanks zaxarias! I modify my curly braces and that works!
Can we please see your working code ?  There was much more than missing braces wrong with it.
214  Using Arduino / Programming Questions / Re: Programming assistance with a servo on: July 26, 2014, 03:41:40 pm
Quote
Pin 9 is used by the LCD.
But you are trying to output a PWM signal to it which won't work with the servo attached.
From http://arduino.cc/en/reference/servo
Quote
On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins

What about the dodgy if command lines ?
215  Using Arduino / Programming Questions / Re: Programming assistance with a servo on: July 26, 2014, 03:10:47 pm
You don't say which board you are using but whatever else is going on using the Servo library prevents the use of PWM on pins 9 and 10 on boards other than the Mega so
Code:
uint8_t BLPin = 9;
and
Code:
  analogWrite(BLPin, backlightSetting);
won't work correctly.

Your real problem with controlling the servo is in these 2 lines
Code:
  if (press1 == LOW);
Code:
  if (press2 == LOW);
Study them carefully and compare them with
Code:
  if (Cursor >= columns)
216  Using Arduino / Programming Questions / Re: [half Solved, Still in doubt]button function return wrong on: July 26, 2014, 02:21:39 pm
In the program that you just posted this is the bPress() function
Code:
int bPress(int bPin){                                                             //button function

}
Mind you, as it is never called the fact that it does nothing is not a problem.

Can you please describe the problem with your current program ?

By the way, it is a good idea to save versions of your program as it evolves/changes so that you can go back and see what you did and how/why.
217  Using Arduino / Programming Questions / Re: button function return wrong on: July 26, 2014, 01:23:47 pm
Please do us, and yourself, a favour and post a complete program that exhibits the problem rather than bits and pieces.
218  Using Arduino / Programming Questions / Re: pushbutton setpoint for temp controller on: July 26, 2014, 12:22:06 pm
Code:
    int(24);
I assume that you meant to set a variable to a value with this and similar lines.

You nearly managed it with
Code:
   float (X=28);
but why the attempt to cast it to float and why does the value assigned to X never get used in the program ?
219  Using Arduino / Programming Questions / Re: [Solved]how to simplify createChar() custom character written to 2X16 lcd? on: July 26, 2014, 12:15:43 pm
Code:
  sprintf(myText, "%c%02d:%02d:%02d %c  PigOS", TIME, HR, MIN, SEC, TIME);
  lcdPrintXYSpecialLine(0, 0, myLine);
What's the point of using sprintf() to format a buffer (myText) with data then outputting a different buffer (myLine) ?
220  Using Arduino / Programming Questions / Re: Buttons and Led's - Button switching too quickly on: July 26, 2014, 11:29:11 am
Quote
Just so I know for future use, is there a reason starting at Pin 1 is a bad thing?
It is if  you want to use the Serial functions in your program because hardware Serial uses pins 0 and 1.  Even if your program does not intrinsically use Serial it is a good idea to allow for it to be used for printing debugging information whilst testing.
221  Using Arduino / Programming Questions / Re: SmartGPU2 Software Serial on: July 26, 2014, 11:21:25 am
As an experiment try using a name other than mySerial, but what I meant was put the
Code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(13,12);
in your main program file, not in the library.
222  Using Arduino / Programming Questions / Re: how to simplify createChar() custom character written to 2X16 lcd? on: July 26, 2014, 11:17:20 am
Quote
is so, is it possible to use words instead of this 0x02?
Yes.  Use #defines as suggested in an earlier reply or use an enum data type.  Either will allow you to use meaningful names that will be translated into numbers to access the corresponding user defined symbol.
223  Using Arduino / Programming Questions / Re: LCDs and Strings and Substrings Oh My - Need help with my C++ on: July 26, 2014, 11:07:21 am
What do you see if you Serial.println() newString in the last else ?  Print a character such as > before it and < after it so that you can see how long it is.
224  Using Arduino / Programming Questions / Re: SmartGPU2 Software Serial on: July 26, 2014, 09:12:39 am
What that #define does is to cause all instances of SERIALPORT in the source code to be replaced with (Serial) so it would be worth a try to create an instance of SoftwareSerial called mySerial and change the #define to
Code:
#define SERIALPORT mySerial

Note that I have left the brackets off as I believe that they are not necessary but try it for yourself as you have nothing to lose.
225  Using Arduino / Programming Questions / Re: LCDs and Strings and Substrings Oh My - Need help with my C++ on: July 26, 2014, 08:34:54 am
Firstly let's give the normal advice and suggest that you use C style strings instead of Strings, particularly with all that String manipulation which tends to fragment memory.
Pages: 1 ... 13 14 [15] 16 17 ... 285