Hi everyone. Newbie here and sorry for disturbing and if you mind can help me
I was trying to compile two sketches(LCD & Servo ) into 1 Arduino UNO board. Anyone can help how to do that?
This is the sketch for LCD :
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(16, 2);
lcd.print("Sunny Is A Panda");
}
You don't really ever combine sketches. What you do is to decide what things you want your sketch to do and then write it. Some times you can borrow code from other sketches.
The type of sketches you have posted show the way to control servos, leds, ect
Yes. You used quote tags, not code tags. Do NOT use the stupid Copy For Forum option in the IDE. Ctrl-A (select all), Ctrl-C (copy), and Ctrl-V (paste) (after pressing the # icon above the happy faces) are all that you need.
Yes. You used quote tags, not code tags. Do NOT use the stupid Copy For Forum option in the IDE. Ctrl-A (select all), Ctrl-C (copy), and Ctrl-V (paste) (after pressing the # icon above the happy faces) are all that you need.
Okay thanks. I tried to compile and upload the sketch to my R3, but get this error :
avrdude: stk500_getsync(): not in sync: resp=0x00
I've checked everything, Correct port, Usb is plugged.
The sketch i used :
Ok guys the sync error has solved. Successfully uploaded the sketch and both RX and TX flashed awhile after uploaded. But the current situation still the same as before uploading the sketch (LCD blank, servo motor moving). The LCD Screen didn't show what i typed, as the servo motor still works the same before the sketch is uploaded
Any idea?
Here's the sketch im using
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#include <Servo.h>
Servo myservo;Â
int pos = 0;Â Â
void setup() {
 lcd.begin(16, 2);
 lcd.print("Sunny Is A Panda");
myservo.attach(9);
}
void loop() {
 lcd.setCursor(0, 1);
 lcd.print(millis()/1000);
 for(pos = 0; pos < 180; pos += 1)
 {                Â
  myservo.write(pos);      Â
  delay(15);           Â
 }
 for(pos = 180; pos>=1; pos-=1)  Â
 {               Â
  myservo.write(pos);      Â
  delay(15);  }
}
tmd3:
What does it do?
What did you expect it do do?
Did either of the two sketches work before you combined them?
Hi there, thanks for the reply.
I'm trying to make the LCD displays the word " Sunny is a panda" at the same time making the servo motor functions and delay awhile, which both of the components are connected to a breadboard and then to the board.
The situation is still the same as before upload, which is the LCD still lights up but nothing was displayed, the servo motor keeps turning.
This is the components I'm using (note that some the shield pins isn't connected due to lacking of male- female pins)
The LCD lights up, and the Cytron servo motor is moving
Okay guys i tried to rejoin the pins but this time i just plugged the LCD Keypad Shield straight to the board. It works perfectly after i upload a LCD sketch. But when i rejoin them back to the breadboard, it just showing the white boxes. Any idea?
Dannysj:
,,, plugged the LCD Keypad Shield straight to the board. It works perfectly ,,, when i rejoin them back to the breadboard, it can't function again ... Any idea?
My first guess: wiring error.
Are you routing connections between the Arduino and the LCD via the breadboard? Can you tell us why?
Dannysj:
,,, plugged the LCD Keypad Shield straight to the board. It works perfectly ,,, when i rejoin them back to the breadboard, it can't function again ... Any idea?
My first guess: wiring error.
Are you routing connections between the Arduino and the LCD via the breadboard? Can you tell us why?
Wiring error? Mind to explain ?> @@
Yes I'm trying to build a connection between the LCD keypad, sensor shield, and the Uno via breadboard. The main reason I'm doing this to make a simple controller from the LCD keypad to input commands to the sensor shield, and before that I'm trying to simplify by routing them first.