Serial monitor problem using Widget code

General MicroView Support area - You have questions, find your answers here.

Moderators: phalanx, Help@GeekAmmo, marcus@geekammo

Post Reply
davew
Posts: 2
Joined: Mon Aug 18, 2014 2:32 pm

Serial monitor problem using Widget code

Post by davew » Mon Aug 18, 2014 6:37 pm

Hi all,

My original problem arose when I added widget code to DS18B20 demo code. The Serial Monitor started showing garbage. Testing the Microview demos with Serial Monitor added produced mixed results, until I noticed that the placement of the Serial.begin in Setup made a difference.

Placing it before the uView.begin() is a problem, placing it after is OK!!

I'm not an expert programmer, but I'm guessing that uView.begin() is messing up interrupts or timers.

Sample code based on the Cube demo is here (paste the setup() and loop() into the original):

Code: Select all

/******************************************************************************
MicroViewCube.ino
Rotating a 3-D Cube on the MicroView Display
Jim Lindblom @ SparkFun Electronics
Original Creation Date: June 9, 2014
*/
#include <MicroView.h>

// code cut for brevity


void setup()
{
  Serial.begin(9600);  // Serial.begin here causes garbage in Serial Monitor

	uView.begin();
	uView.clear(ALL);
	uView.display();  
// Serial.begin(9600);  // Serial.begin here and Serial Monitor is OK
}

void loop()
{
	drawCube();
	delay(ROTATION_SPEED);
Serial.println("hmmm ");
}

// Draw cube removed... paste the setup() and loop() into the original MicroViewCube demo

Help@GeekAmmo
Posts: 41
Joined: Fri Jul 18, 2014 11:45 am

Re: Serial monitor problem using Widget code

Post by Help@GeekAmmo » Wed Aug 20, 2014 1:31 am

Hi Davew,

If you update the MicroView library, this should be fixed. The previous version of the library declared Serial.begin(115200) inside uView.begin() to be used by checkComm(), we found out that this is not a good way, and then removed the Serial.begin(115200) from uView.begin().

This explains why your Serial.begin(9600) works after uView.begin().

Hope this helps

Cheers
JP

davew
Posts: 2
Joined: Mon Aug 18, 2014 2:32 pm

Re: Serial monitor problem using Widget code -FIXED

Post by davew » Wed Aug 20, 2014 3:20 pm

Thanks,

All working now.

:hand: :D

Dave

Post Reply