[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 574: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 630: sizeof(): Parameter must be an array or an object that implements Countable
Plum Geek Forum • Ringo's Light Sensor Sketches
Page 1 of 1

Ringo's Light Sensor Sketches

Posted: Wed Jun 29, 2016 1:56 am
by Bob
I am working my way through Ringo Educational Guide and everything was going fairly smoothly until I got to page 39, Using Ringo's Light Sensors and needing to use the Serial Monitor.

I typed the short sketch on page 39 that reads the right light sensor and prints the value in the Serial Monitor. No compiling problems but the serial monitor just displays a series of weird punctuation characters all on one line, not the expected values of 0 to 1024 and no line feeds.

I then tried the program on page 41 reading all three sensors and I got the same result.

When I tried an included sketch like AnalogInOutSerial, the Serial Monitor appears to function properly.

Any ideas where the problem lies with my light sensors and sketch?

Re: Ringo's Light Sensor Sketches

Posted: Tue Jul 05, 2016 2:13 am
by sil
I think its just a comms error that does it. I get it occasionally and I just unplug everything,reboot my asus notebook (dev machine) turn off ringo and reconnect it all and try again and its good. Could also be you have the comm speed (baud rate) set incorrectly. My gear is at home so I cant check and give you better guidance right now. I vaguely recall the comm port speed is mentioned in the docs when setting up, I suggest checking for that first, comms speeds tend to have to be specified correctly in order to work, you cant just put it on the highest speed.

Re: Ringo's Light Sensor Sketches

Posted: Sat Jul 16, 2016 2:18 am
by Kevin
Hello Bob,

It sounds like the baud rate is set incorrectly in the serial monitor window. In the serial monitor should be set to 57600 in the lower right corner.

You can actually initialize the processor to output data at any baud rate you like. The Serial Monitor window defaults to 9600 baud, and the Arduino example sketches use this 9600 baud by default so that's why they worked correctly.

You can set the serial speed in your code with Serial.begin(9600); or some other speed. The HardwareBegin() function does this for you on Ringo, setting it to the 57600 speed. We use 57600 because it requires much less time to output the data and it is still reliable. This makes a difference when polling the gyro and accellerometer quickly during debugging.

Sorry for the confusion.
-Kevin