SparkFun Forums 

Where electronics enthusiasts find answers.

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

Moderators: marcus@geekammo, Help@GeekAmmo

By davew
#173846
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
By Help@GeekAmmo
#173894
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