Help me,plz. I need help!


#1

I cant found what is wrong in code. plz help me where is wrong and how to change…ㅠㅠ

#include <Servo.h>

#define S0 3
#define S1 4
#define S2 5
#define S3 6
#define sensorout 7

int R=0;
int G=0;
int B=0;

Servo bottomservo;

void setup() {
pinMode(S0,OUTPUT);
pinMode(S1,OUTPUT);
pinMode(S2,OUTPUT);
pinMode(S3,OUTPUT);
pinMode(sensorout,INPUT);

bottomservo.attach(8);

digitalWrite(S0,HIGH);
digitalWrite(S1,LOW);

Serial.begin(9600);

}

void loop() {
digitalWrite(S2,LOW);
digitalWrite(S3,LOW);
R=pulseIn(sensorout,LOW);

digitalWrite(S2,HIGH);
digitalWrite(S3,HIGH);
G=pulseIn(sensorout,LOW);

digitalWrite(S2,LOW);
digitalWrite(S3,HIGH);
B=pulseIn(sensorout,LOW);

if(R<60&&R>40&&G<100&&G>60)
{
bottomservo.write(110);
delay(100);
}
if(G<60&&G>50&&B<60&&B>50)
{
bottomservo.write(80);
delay(100);
}
if(R<90&&R>70&&B<80&&B>70)
{
bottomservo.write(30);
delay(100);
}
Serial.print(“R=”);
Serial.println®;
Serial.print(“G=”);
Serial.println(G);
Serial.print(“B=”);
Serial.println(B);
delay(1000);
bottomservo.write(0);
}


#2

dear eowndms,

can you try this code please?

#include <Servo.h>

#define S0 3
#define S1 4
#define S2 5
#define S3 6
#define sensorout 7

int R=0;
int G=0;
int B=0;

Servo bottomservo;

void setup() {
pinMode(S0,OUTPUT);
pinMode(S1,OUTPUT);
pinMode(S2,OUTPUT);
pinMode(S3,OUTPUT);
pinMode(sensorout,INPUT);

bottomservo.attach(8);

digitalWrite(S0,HIGH);
digitalWrite(S1,LOW);

Serial.begin(9600);

}

void loop() {
digitalWrite(S2,LOW);
digitalWrite(S3,LOW);
R=pulseIn(sensorout,LOW);

digitalWrite(S2,HIGH);
digitalWrite(S3,HIGH);
G=pulseIn(sensorout,LOW);

digitalWrite(S2,LOW);
digitalWrite(S3,HIGH);
B=pulseIn(sensorout,LOW);

if(R<60&&R>40&&G<100&&G>60)
{
bottomservo.write(110);
delay(100);
}
if(G<60&&G>50&&B<60&&B>50)
{
bottomservo.write(80);
delay(100);
}
if(R<90&&R>70&&B<80&&B>70)
{
bottomservo.write(30);
delay(100);
}
Serial.print(“R=”);
Serial.println®;
Serial.print(“G=”);
Serial.println(G);
Serial.print(" B= ");
Serial.println(B);
delay(1000);
bottomservo.write(0);
}


#3

Hi there, might be a problem when copy/paste but line 60 shows “Serial.println®;” instead of “Serial.println®;”

Anyway, maybe you can show us the error the IDE is returning to you?


#4

Serial.println®;

make it Serial.Println( R );