Shop
OBEX
P1 Docs
P2 Docs
Learn
Events
sensorColorpal — Parallax Forums
toggle menu
Categories
Discussions
Sign In
·
Register
Sign In
·
Register
Categories
Discussions
Sign In
·
Register
×
Home
›
Accessories
sensorColorpal
masalcido
Posts:
8
2017-03-13 23:40
in
Accessories
I HAVE A PROBLEM WITH THIS SENSOR SOMEONE COULD HELP ME
Comments
kwinn
Posts:
8,697
2017-03-14 02:05
masalcido
wrote:
»
I HAVE A PROBLEM WITH THIS SENSOR SOMEONE COULD HELP ME
Might be a good idea to show what it is hooked up to, how it is hooked up, what kind of problem you are having, and post the code you are using. My psychic powers are a bit low at the moment.
Phil Pilgrim (PhiPi)
Posts:
23,514
2017-03-14 03:21
And you don't need to shout. All caps won't get you help any quicker.
-Phil
masalcido
Posts:
8
2017-03-14 16:38
Here's my code , so i wired up in parallel wiht resistos 2k ti vcc
#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);
}
Publison
Posts:
12,366
2017-03-14 17:21
You can not post the same questions in two threads. Please pick one and stick with that thread.
Sign In
or
Register
to comment.
Comments
Might be a good idea to show what it is hooked up to, how it is hooked up, what kind of problem you are having, and post the code you are using. My psychic powers are a bit low at the moment.
-Phil
#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);
}