SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion area - What have you built with your Micro View

Moderators: marcus@geekammo, Help@GeekAmmo

User avatar
By kgrr
#174068
I thought it would be good to capture software tools that people are using to verify their MicroView is running properly...

One such tool is MicroView Blink from GitHub MicroView-Arduino-Library / examples / LearningKit / Blink / Blink.ino
https://github.com/geekammo/MicroView-A ... /Blink.ino
Code: Select all
#include <MicroView.h>
/*
	MicroView Blink
	Draw a circle for one second, then off for one second, repeatedly.
 
	This example code is in the public domain.
 */
 
// the setup routine runs once when you press reset:
void setup() {                
	uView.begin();
	uView.clear(PAGE);
}

// the loop routine runs over and over again forever:
void loop() {
	uView.circleFill(32,24,10,WHITE,NORM);
	uView.display();
	delay(1000);               // wait for a second

	uView.circleFill(32,24,10,BLACK,NORM);  
	uView.display();
	delay(1000);               // wait for a second
}
User avatar
By kgrr
#174069
Another tool that can be used to verify a MicroView's operation is I2C_Scanner. It will find the addresses of devices hanging on the I2C bus.

https://codebender.cc/sketch:45465
Code: Select all
// --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    http://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// Version 6, August 13, 2014
//    modified for MicroView by Konrad Roeder, WA4OSH
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

#include <MicroView.h>
#include <Wire.h>


void setup()
{
  Wire.begin();

  uView.begin();			// start MicroView
  uView.setFontType(0); 	// set font to the smallest font
}


void loop()
{
  byte error, address;
  int nDevices;
  
  uView.clear(PAGE);
  uView.setCursor(0,0); 	// points cursor to first line
  uView.println("Scanning..");
  uView.display();		

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      uView.print("I2C - 0x");
      if (address<16) 
        uView.print("0");
      uView.print(address,HEX);
      uView.display();

      nDevices++;
    }
    else if (error==4) 
    {
      uView.print("Unknown error at 0x");
      if (address<16) 
        uView.print("0");
      uView.println(address,HEX);
      uView.display();
    }    
  }
  if (nDevices == 0) 
  {
    uView.println("No I2C devices found\n");
  }
  else
  {
    uView.println("done\n");
  }
  uView.display();
  delay(5000);           // wait 5 seconds for next scan
}