Shop OBEX P1 Docs P2 Docs Learn Events
sensor color pal 28380 — Parallax Forums

sensor color pal 28380

i have a problem with thise sensor y could not got the values , just genered diferent lights , but i want to the sensor show me de diferents values of color that found
my code is below, so i need help, i plug the resisotor by 2k ohms in parallel with the sygnal pin and 5v

#include <SoftwareSerial.h>
SoftwareSerial Color90(2, 3);
/*====================================================
/ Connect ColorPAL SIG signal to Arduino pin 2 and 3
/ Baud Rate = 9600 kbps /
/====================================================*/
void setup() {
Serial.begin(9600);
Color90.begin(4800);
pinMode(2,INPUT);
pinMode(3,INPUT);
digitalWrite(2,HIGH); // Enable the pull-up resistor
digitalWrite(3,HIGH); // Enable the pull-up resistor
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
digitalWrite(2,LOW);
digitalWrite(3,LOW);
pinMode(2,INPUT);
pinMode(3,INPUT);
Serial.println("Pass 1");
while( digitalRead(2) != HIGH || digitalRead(3) != HIGH ) {
Serial.println("In the loop");
delay(50);
}
Serial.println("Pass 2");
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
digitalWrite(2,LOW);
digitalWrite(3,LOW);
delay(80);
pinMode(2,INPUT);
pinMode(3,OUTPUT);
delay(100);
}

//

void loop() {

Color90.begin(4800);
Color90.print( "=R!"); delay(500); Color90.print("= Y!"); delay(500); Color90.print("= G!"); delay(500);
Color90.print("00 $ m");
char rByte[9];
rByte[0] = colorPal.read();
if(rByte[0] == '$'){
for(int i=0; i < 9; i++){
rByte = colorPal.read();
Serial.print(rByte);
}
Serial.println();
}
delay(500);
}

Comments

  • i have a problem with thise sensor y could not got the values , just genered diferent lights , but i want to the sensor show me de diferents values of color that found
    my code is below, so i need help, i plug the resisotor by 2k ohms in parallel with the sygnal pin and 5v



    #include <SoftwareSerial.h>
    SoftwareSerial Color90(2, 3);
    /*====================================================
    / Connect ColorPAL SIG signal to Arduino pin 2 and 3
    / Baud Rate = 9600 kbps /
    /====================================================*/
    void setup() {
    Serial.begin(9600);
    Color90.begin(4800);
    pinMode(2,INPUT);
    pinMode(3,INPUT);
    digitalWrite(2,HIGH); // Enable the pull-up resistor
    digitalWrite(3,HIGH); // Enable the pull-up resistor
    pinMode(2,OUTPUT);
    pinMode(3,OUTPUT);
    digitalWrite(2,LOW);
    digitalWrite(3,LOW);
    pinMode(2,INPUT);
    pinMode(3,INPUT);
    Serial.println("Pass 1");
    while( digitalRead(2) != HIGH || digitalRead(3) != HIGH ) {
    Serial.println("In the loop");
    delay(50);
    }
    Serial.println("Pass 2");
    pinMode(2,OUTPUT);
    pinMode(3,OUTPUT);
    digitalWrite(2,LOW);
    digitalWrite(3,LOW);
    delay(80);
    pinMode(2,INPUT);
    pinMode(3,OUTPUT);
    delay(100);
    }

    //

    void loop() {
    char rByte[9];
    Color90.begin(4800); Color90.print("= V !"); delay(500); Color90.print("= R !");
    Color90.print("= $ m !");

    rByte[0] = Color90.read();
    if(rByte[0] == '$'){
    for(int i=0; i < 9; i++){
    rByte = Color90.read();
    Serial.print(rByte);
    }
    Serial.println();
    }
    delay(500);

    }
Sign In or Register to comment.