Sorry for the newb question - I am able to get my serial LCD to work fine using the example code, and was able to combine with the LED Dim example, using the LCD to display the POT position and LED output, and a few other things.
Now I am looking to use a basic servo - using the Servo “Knob” code - this worked fine but the Servo was very jerky and I would like to use the LCD to tell me what is going on.
I have included the SoftwareSerial.H Lib (included by using the “Sketch/ImportLibrary” tool) - and as best as I can tell have the same set up as was used in my first LCD sketch and edits as well as the LED dimming - but now I keep getting “Not Defined In Scope error " 'clearDisplay” and ‘setLCDCursor’ Not Defined In Scope error - both in the Setup and main Loop. I understand these may be in an LCD Library - but I did not have to include these before -
#include <SoftwareSerial.h>
// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
#include <Servo.h>
#include <SoftwareSerial.h>
Servo myservo; // create servo object to control a servo
SoftwareSerial lcd(2, 3); // This is required, to start an instance of an LCD
int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
lcd.begin(9600); // Start the LCD at 9600 baud
clearDisplay();
}
void loop()
{
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
clearDisplay();
setLCDCursor(0);
lcd.print(val);
.....rest of code truncated.....
Error Log
Pot_to_Servo_Disp_072313.ino: In function ‘void setup()’:
Pot_to_Servo_Disp_072313:19: error: ‘clearDisplay’ was not declared in this scope
Pot_to_Servo_Disp_072313.ino: In function ‘void loop()’:
Pot_to_Servo_Disp_072313:26: error: ‘clearDisplay’ was not declared in this scope
Pot_to_Servo_Disp_072313:27: error: ‘setLCDCursor’ was not declared in this scope
What then has me baffled - is why then does the “lcd.print(val);” not get the same error -