int _ABVAR_1_dist;
int pinkR = 255;
int pinkG = 0;
int pinkB = 156;
int grassgreenR = 153;
int grassgreenG = 204;
int grassgreenB = 51;
int warmyellowR = 248;
int warmyellowG = 141;
int warmyellowB = 30;
int Rpin = 11;
int Gpin = 9;
int Bpin = 10;
int ardublockUltrasonicSensorCodeAutoGeneratedReturnCM(int trigPin, int echoPin)
{
int duration;
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(5);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
duration = duration / 59;
return duration;
}
void setup()
{
pinMode(Rpin,OUTPUT);
pinMode(Gpin,OUTPUT);
pinMode(Bpin,OUTPUT);
{
Serial.begin(9600);
digitalWrite( 5 , LOW );
_ABVAR_1_dist = 0;
}
void loop()
{
_ABVAR_1_dist = ardublockUltrasonicSensorCodeAutoGeneratedReturnCM( 5 , 4 ) ;
Serial.print( "distace:" );
Serial.print( _ABVAR_1_dist );
Serial.println("");
if (( ( _ABVAR_1_dist ) > ( 10 ) ))
{
if (( ( _ABVAR_1_dist ) > ( 50 ) ))
{
analogWrite(Rpin , grassgreenR);
analogWrite(Gpin , grassgreenG);
analogWrite(Bpin , grassgreenB);
Serial.print( "Far Away" );
Serial.println("");
}
else
{
analogWrite(Rpin, warmyellowR);
analogWrite(Gpin, warmyellowG);
analogWrite(Bpin, warmyellowB);
Serial.print( "slow speed to go!" );
Serial.println("");
}
}
else
{
analogWrite(Rpin, pinkR );
analogWrite(Gpin, pinkG);
analogWrite(Bpin, pinkB);
Serial.print( "Too Close!" );
Serial.println("");
}
delay( 200 );
int pinkR = 255;
int pinkG = 0;
int pinkB = 156;
int grassgreenR = 153;
int grassgreenG = 204;
int grassgreenB = 51;
int warmyellowR = 248;
int warmyellowG = 141;
int warmyellowB = 30;
int Rpin = 11;
int Gpin = 9;
int Bpin = 10;
int ardublockUltrasonicSensorCodeAutoGeneratedReturnCM(int trigPin, int echoPin)
{
int duration;
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(5);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
duration = duration / 59;
return duration;
}
void setup()
{
pinMode(Rpin,OUTPUT);
pinMode(Gpin,OUTPUT);
pinMode(Bpin,OUTPUT);
{
Serial.begin(9600);
digitalWrite( 5 , LOW );
_ABVAR_1_dist = 0;
}
void loop()
{
_ABVAR_1_dist = ardublockUltrasonicSensorCodeAutoGeneratedReturnCM( 5 , 4 ) ;
Serial.print( "distace:" );
Serial.print( _ABVAR_1_dist );
Serial.println("");
if (( ( _ABVAR_1_dist ) > ( 10 ) ))
{
if (( ( _ABVAR_1_dist ) > ( 50 ) ))
{
analogWrite(Rpin , grassgreenR);
analogWrite(Gpin , grassgreenG);
analogWrite(Bpin , grassgreenB);
Serial.print( "Far Away" );
Serial.println("");
}
else
{
analogWrite(Rpin, warmyellowR);
analogWrite(Gpin, warmyellowG);
analogWrite(Bpin, warmyellowB);
Serial.print( "slow speed to go!" );
Serial.println("");
}
}
else
{
analogWrite(Rpin, pinkR );
analogWrite(Gpin, pinkG);
analogWrite(Bpin, pinkB);
Serial.print( "Too Close!" );
Serial.println("");
}
delay( 200 );