Ringo's Light Sensor Sketches

Ringo setup, hardware, basic programming. User to user support.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Bob
Posts: 1
Joined: Wed Mar 02, 2016 2:30 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Ringo's Light Sensor Sketches

Postby Bob » Wed Jun 29, 2016 1:56 am

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?

User avatar
sil
Posts: 40
Joined: Thu Oct 01, 2015 1:04 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Ringo's Light Sensor Sketches

Postby sil » Tue Jul 05, 2016 2:13 am

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.

Kevin
Posts: 180
Joined: Tue Jul 28, 2015 12:56 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Ringo's Light Sensor Sketches

Postby Kevin » Sat Jul 16, 2016 2:18 am

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


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 22 guests