system
August 24, 2018, 12:57pm
1
ATTCHMENT is half code my project . During writing code I think to compile my code now to check whether I am writing code correctly or not.
But after compiling I got 2 errors . THAT ARE -------->1.expected initializer before 'void'[HIGHLIGHTING void loop()] 2.expected initializer before 'void'[HIGHLIGHTING void setup()}
WHY IT IS COMING?
HELP ME!!!!!!!!!!!!!!!!!!!!!!!!
CODE_FOR_ADVANCED_ROBO_VACCUM_CLEANER__NAME____Rhobus__VAC.clea.ino (1.03 KB)
system
August 24, 2018, 12:58pm
2
Post all the code, post the exact error message.
Edit: Don't report sound advice to the moderators.
Have not looked at the code, usually the error is related to a missing semicolon ";" or a missing library.
Check the </> code tags when posting your code.
I - for one - rarely read 'attached' code
Hi,
Welcome to the forum.
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
What model Arduino are you using?
Tom...
system
August 24, 2018, 2:14pm
6
TomGeorge:
Hi,
Welcome to the forum.
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
What model Arduino are you using?
Tom...
Sorry i didn't know how to post code but next time i will do in same manner as shown.
And i am using ARDUINO UNO
system
August 24, 2018, 2:17pm
7
And i am using ARDUINO UNO
You still need a semicolon, whatever processor you're using.
system
August 24, 2018, 2:24pm
8
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
#include <Wire.h>
#include <Servo.h>
# define ls a0 / LEFT IR SENSOR
# define rs a3 / RIGHT IR SENSOR
# define rm 9 / RIGHT WHEEL MOTOR
# define lm 10 / LEFT WHEEL MOTOR
# define buzled 11 / BUZZER & LED
# define echoPin a1 / ECHO PIN OF ULTRASONIC SENSOR
# define trigPin a2 / TRIG PIN OF ULTRASONIC SENSOR
# define VM 12 / VACCUM MOTOR
const byte ROWS = 4;
const byte COLS = 3;
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
LiquidCrystal_I2C lcd(0x21, 16, 2);
Servo myservo
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
myservo.attach(13);
pinMode(ls,INPUT);
pinMode(rs,INPUT);
pinMode(lm,OUTPUT);
pinMode(rm,OUTPUT);
pinMode(buzled,OUTPUT);
pinMode(vm,OUTPUT);
pinMode(trigPin, OUTPUT);// set the trig pin to output (Send sound waves)
pinMode(echoPin, INPUT);// set the echo pin to input (recieve sound waves)
lcd.init();
lcd.backlight();
lcd.clear();
lcd.print(" HELLO!ARE YOU ");
lcd.setCursor(0,1);
lcd.print("FEARING WITH ME?");
delay(10000);
lcd.clear();
lcd.print(" LET ME ");
lcd.setCursor(0,1);
lcd.print("INTRODUCE MYSELF");
delay(5000);
lcd.clear();
lcd.print(" LET ME ");
lcd.setCursor(0,1);
lcd.print("INTRODUCE MYSELF");
delay(5000);
lcd.clear();
}
void loop() {
// put your main code here, to run repeatedly:
}
system
August 24, 2018, 2:26pm
9
Servo myservo
A semicolon missing.
This has already been mentioned.
system
August 24, 2018, 2:33pm
10
AWOL:
Servo myservo
A semicolon missing.
This has already been mentioned.
Now it is working .......
THANKS!!!!!!!!!!
PRABHASKUMAR:
Now it is working .......
THANKS!!!!!!!!!!
How? Did you fix the "vm" and "VM" variable name?
And this;
# define ls a0 / LEFT IR SENSOR
Should be this;
#define ls A0 // LEFT IR SENSOR
along with the other # define statements?
C++ is case sensitive so vm variable is not the same as VM variable.
Can you post your working code please?
Tom...
system
August 24, 2018, 3:12pm
12
Yes, and I fixed it before your message.
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
#include <Wire.h>
#include <Servo.h>
# define ls A0 // LEFT IR SENSOR
# define rs A3 // RIGHT IR SENSOR
# define rm 9 // RIGHT WHEEL MOTOR
# define lm 10 // LEFT WHEEL MOTOR
# define buzled 11 // BUZZER & LED
# define echoPin A1 // ECHO PIN OF ULTRASONIC SENSOR
# define trigPin A2 // TRIG PIN OF ULTRASONIC SENSOR
# define VM 12 // VACCUM MOTOR
const byte ROWS = 4;
const byte COLS = 3;
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
LiquidCrystal_I2C lcd(0x21, 16, 2);
Servo myservo;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
myservo.attach(13);
pinMode(ls,INPUT);
pinMode(rs,INPUT);
pinMode(lm,OUTPUT);
pinMode(rm,OUTPUT);
pinMode(buzled,OUTPUT);
pinMode(VM,OUTPUT);
pinMode(trigPin, OUTPUT);// set the trig pin to output (Send sound waves)
pinMode(echoPin, INPUT);// set the echo pin to input (recieve sound waves)
lcd.init();
lcd.backlight();
lcd.clear();
lcd.print(" HELLO!ARE YOU ");
lcd.setCursor(0,1);
lcd.print("FEARING WITH ME?");
delay(10000);
lcd.clear();
lcd.print(" LET ME ");
lcd.setCursor(0,1);
lcd.print("INTRODUCE MYSELF");
delay(5000);
lcd.clear();
lcd.print("I'm robus_vaccum");
lcd.setCursor(0,1);
lcd.print(" cleaner ");
delay(5000);
lcd.clear();
lcd.print("1-->TO CLEAN ,");
lcd.setCursor(0,1);
lcd.print("2-->TO PLAY ,");
delay(5000);
lcd.print("3->TO CLEAN LINE");
lcd.setCursor(0,1);
lcd.print("CHOOSE THE NO.");
delay(5000);
lcd.clear();
lcd.print("AND PRESS");
lcd.setCursor(0,1);
lcd.print("ON KEYPAD.");
delay(5000);
lcd.clear();
}
void loop() {
// put your main code here, to run repeatedly:
}
system
August 25, 2018, 11:48am
13
Hello,
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
#include <Wire.h>
#include <Servo.h>
# define ls A0 // LEFT IR SENSOR
# define rs A3 // RIGHT IR SENSOR
# define rm 9 // RIGHT WHEEL MOTOR
# define lm 10 // LEFT WHEEL MOTOR
# define buzled 11 // BUZZER & LED
# define echoPin A1 // ECHO PIN OF ULTRASONIC SENSOR
# define trigPin A2 // TRIG PIN OF ULTRASONIC SENSOR
# define VM 12 // VACCUM MOTOR
const byte ROWS = 4;
const byte COLS = 3;
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
LiquidCrystal_I2C lcd(0x21, 16, 2);
Servo myservo;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
myservo.attach(13);
pinMode(ls,INPUT);
pinMode(rs,INPUT);
pinMode(lm,OUTPUT);
pinMode(rm,OUTPUT);
pinMode(buzled,OUTPUT);
pinMode(VM,OUTPUT);
pinMode(trigPin, OUTPUT);// set the trig pin to output (Send sound waves)
pinMode(echoPin, INPUT);// set the echo pin to input (recieve sound waves)
lcd.init();
lcd.backlight();
lcd.clear();
lcd.print(" HELLO!ARE YOU ");
lcd.setCursor(0,1);
lcd.print("FEARING WITH ME?");
delay(10000);
lcd.clear();
lcd.print(" LET ME ");
lcd.setCursor(0,1);
lcd.print("INTRODUCE MYSELF");
delay(5000);
lcd.clear();
lcd.print("I'm robus_vaccum");
lcd.setCursor(0,1);
lcd.print(" cleaner ");
delay(5000);
lcd.clear();
lcd.print("1-->TO CLEAN ,");
lcd.setCursor(0,1);
lcd.print("2-->TO PLAY ,");
delay(5000);
lcd.print("3->TO CLEAN LINE");
lcd.setCursor(0,1);
lcd.print("CHOOSE THE NO.");
delay(5000);
lcd.clear();
lcd.print("AND PRESS");
lcd.setCursor(0,1);
lcd.print("ON KEYPAD.");
delay(5000);
lcd.clear();
}
void loop() {
// put your main code here, to run repeatedly:
}
Please help me to write the code inwhich if any key of keypad is pressed then lcd 16x2 display 'THANK you'
system
August 25, 2018, 11:56am
15
Please help me to write the code inwhich if any key of keypad is pressed then lcd 16x2 display 'THANK you'
J-M-L
August 25, 2018, 12:02pm
16
study the keypad library examples , and give it a try.
system
August 25, 2018, 12:07pm
18
I can't get help from your shared website
J-M-L
August 25, 2018, 12:08pm
19
bye - come back in a few days
spycatcher2k:
@PRABHASKUMAR - you have crossposted this thread! I have reported you for this, and also added you to the 'do not help this person under any circumstances' list.
There's a list for that? Great idea.
The OP seems want people to simply write his code for him. Looking at those defines, I don't have much hope for his "advanced robotic vacuum cleaner" project.