Go Down

Topic: Can't read Atlas Scientific colour detector (Read 4 times) previous topic - next topic

phil88

thanks for that,

I open up the serial monitor and get this...

Code: [Select]
͹ÙL

(values change when i close and re-open the monitor) for example:

Code: [Select]
Ô»Ðó

Code: [Select]
ݽùÌ

robtillaart

that looks like some ascii code very promising (said the optimist)
Code: [Select]

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); 

void setup() 
{
  Serial.begin(115200);
  Serial.println("Start color sensor");

  // set the data rate for the NewSoftSerial port
  mySerial.begin(38400);
  mySerial.print('C');
}

void loop()
{
  if (mySerial.available())
  {
    char c = mySerial.read();
    Serial.print(c, DEC);  // <<<<<<<<<<<<<<<<<<<<<<<<<<<<< line changed
    if (c == ',') Serial.println(); // split the R G and B
    if (c == 13) Serial.println(); // extra newline
  }
}

can you give it a try?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

phil88

cool,

im getting a new reading roughly every second now...

Code: [Select]
ɵÁ\?Ё? p?aà°?ÁY` 1?aÿ?ðÉÜp?aàЁ?£ p?#à°???¡ p?#øÐÅ?£ p?#àðÉ??! p?øÌùñ 0?apÀ̹±?á cøÐÅ?£ p?#à°?ÁK°cà?Ùpcà

robtillaart

There are coming to much bytes, could also be a loose wire(!)

Have you try alternative baud rates?
9600, 19200, 38400 (already tested), 115200?

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

summersgillb

Thanks, robtillaart.  I tried your code, too, but I still don't get anything back.  

Go Up