CAN somebody help me build the code,Im trying to make 3 different bin with servo,I use the android app as a qr scanner.after qr scanner scan string one sent to servo a,rotate 180 degree then rotate back to 0 degree after(wait time 5 sec).same to other servo.Im am newbie.Sorry for my bad English. please fix my coding and im also using hc-06 bluetooth module
ASAP
TQ
#include <LiquidCrystal.h>
#include <Servo.h>
const int Servoa = 7;
const int Servob = 8;
const int Servoc = 9;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int pos = 0;
String readString;
void setup() {
Serial.begin(9600);
lcd.begin(16,2);
pinMode(Servoa, OUTPUT);
pinMode(Servoc, OUTPUT);
pos = digitalRead(Servo1);
lcd.setCursor(2,0);
lcd.print(“SAVE EARTH”);
lcd.setCursor(4,1);
lcd.print(“TQ”);
}
void loop() {
while (Serial.available()) {
delay(3);
char c = Serial.read();
readString += c;
}
if (readString.length() >0)
{
Serial.println(readString);
if (readString == “6vevqreytodthh1p1isg”)
{
digitalWrite(Servoa, pos = 0; pos <= 180; pos += 1);
}
{
lcd.setCursor(2,0);
lcd.print(“PLASTIC”);
lcd.setCursor(4,1);
lcd.print(“DETECTED!”);
delay(30000);
}
digitalWrite(Servoa, pos = 180; pos >= 0; pos -= 1);
lcd.setCursor(2,0);
lcd.print(“SAVE EARTH”);
lcd.setCursor(4,1);
lcd.print(“TQ”);
{ readString="";
}
}
}
{ if (readString.length() >0)
{
Serial.println(readString);
if (readString == “6vevqreytodthh1p1isg”)
{
digitalWrite(Servoa, pos = 0; pos <= 180; pos += 1);
}
{
lcd.setCursor(2,0);
lcd.print(“TINCAN”);
lcd.setCursor(4,1);
lcd.print(“DETECTED!”);
delay(30000);
}
digitalWrite(Servoa, pos = 180; pos >= 0; pos -= 1);
lcd.setCursor(2,0);
lcd.print(“SAVE EARTH”);
lcd.setCursor(4,1);
lcd.print(“TQ”);
{ readString="";
}
}
}
{ if (readString.length() >0)
{
Serial.println(readString);
if (readString == “6vevqreytodthh1p1isg”)
digitalWrite(Servoa, pos = 0; pos <= 180; pos += 1);
}
{
lcd.setCursor(2,0);
lcd.print(“PAPER”);
lcd.setCursor(4,1);
lcd.print(“DETECTED!”);
delay(30000);
}
digitalWrite(Servoa, pos = 180; pos >= 0; pos -= 1);
lcd.setCursor(2,0);
lcd.print(“SAVE EARTH”);
lcd.setCursor(4,1);
lcd.print(“TQ”);
{ readString="";
}
}
}