SparkFun Forums 

Where electronics enthusiasts find answers.

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

Moderators: marcus@geekammo, Help@GeekAmmo

User avatar
By redred
#181578
Hi together,

I got stuck at an actual project at home. Besides some sensors and actors (which all are working fine), I have some trouble with the display. Hardware wiring was no problem at all, programming is a problem. Here my setup:

Microview on a breadboard, resistors, wires, bubble display.

According to the Sparkfun Learnpage (here: https://learn.sparkfun.com/tutorials/bu ... okup-guide) we have to pinout the HP Bubble Display:
Code: Select all
  //This pinout is for a bubble dispaly
   //Declare what pins are connected to the GND pins (cathodes)
   int digit1 = 8; //Pin 1
   int digit2 = 5; //Pin 10
   int digit3 = 11; //Pin 4
   int digit4 = 13; //Pin 6

   //Declare what pins are connected to the segments (anodes)
   int segA = 7; //Pin 12
   int segB = 6; //Pin 11
   int segC = 10; //Pin 3
   int segD = 3; //Pin 8
   int segE = 9; //Pin 2
   int segF = 4; //Pin 9
   int segG = 2; //Pin 7
   int segDP= 12; //Pin 5
But now comes the problem, as the Microview uses the Pins 0-6 and A0-A5. According to this page here http://learn.microview.io/intro/general ... oview.html. So after wiring and including the library in my Arduino project, I just adjust the pin declaration:
Code: Select all
  //This pinout is for a bubble dispaly
   //Declare what pins are connected to the GND pins (cathodes)
   int digit1 = A0; //Pin 1
   int digit2 = 0; //Pin 10
   int digit3 = A1; //Pin 4
   int digit4 = A2; //Pin 6

   //Declare what pins are connected to the segments (anodes)
   int segA = 1; //Pin 12
   int segB = 2; //Pin 11
   int segC = A4; //Pin 3
   int segD = 5; //Pin 8
   int segE = A3; //Pin 2
   int segF = 3; //Pin 9
   int segG = 6; //Pin 7
   int segDP= A5; //Pin 5
But when I now try to compile my project, I get a lot of errors. And they all result from the fact, that the "SevSeg.h" library can't handle the variables filled with A0-A5.

Does anyone know how this can be fixed? Can this be fixed by changing the "SevSeg.h" library?

Thanks and regards,
Robert
By scotta
#181582
It compiled fine for me with your changes.

Here's the complete sketch that I used:
Code: Select all
/*
 March 6, 2014
 Spark Fun Electronics
 Nathan Seidle
 Updates by Joel Bartlett

 This code is originally based Dean Reading's Library deanreading@hotmail.com
 http://arduino.cc/playground/Main/SevenSegmentLibrary
 He didn't have a license on it so I hope he doesn't mind me making it public domain: 
 This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).

 This sketch provides a simple counter example for the HP Bubble display from SparkFun.
 https://www.sparkfun.com/products/12710

 Pinout for HP Bubble Display:
 1:  Cathode 1
 2:  Anode E
 3:  Anode C
 4:  Cathode 3
 5:  Anode dp
 6:  Cathode 4
 7:  Anode G
 8:  Anode D
 9:  Anode F
 10: Cathode 2
 11: Anode B
 12: Anode A
 */

#include "SevSeg.h"

//Create an instance of the object.
SevSeg myDisplay;

//Create global variables
unsigned long timer;
int deciSecond = 0;

void setup()
{

  int displayType = COMMON_CATHODE; //Your display is either common cathode or common anode


 //This pinout is for a bubble dispaly
  //Declare what pins are connected to the GND pins (cathodes)
  int digit1 = A0; //Pin 1
  int digit2 = 0; //Pin 10
  int digit3 = A1; //Pin 4
  int digit4 = A2; //Pin 6

  //Declare what pins are connected to the segments (anodes)
  int segA = 1; //Pin 12
  int segB = 2; //Pin 11
  int segC = A4; //Pin 3
  int segD = 5; //Pin 8
  int segE = A3; //Pin 2
  int segF = 3; //Pin 9
  int segG = 6; //Pin 7
  int segDP= A5; //Pin 5
       
  int numberOfDigits = 4; //Do you have a 1, 2 or 4 digit display?

  myDisplay.Begin(displayType, numberOfDigits, digit1, digit2, digit3, digit4, segA, segB, segC, segD, segE, segF, segG, segDP);

  myDisplay.SetBrightness(100); //Set the display to 100% brightness level

  timer = millis();
}

void loop()
{
  //Example ways of displaying a decimal number
  char tempString[10]; //Used for sprintf
  sprintf(tempString, "%4d", deciSecond); //Convert deciSecond into a string that is right adjusted
  //sprintf(tempString, "%d", deciSecond); //Convert deciSecond into a string that is left adjusted
  //sprintf(tempString, "%04d", deciSecond); //Convert deciSecond into a string with leading zeros
  //sprintf(tempString, "%4d", deciSecond * -1); //Shows a negative sign infront of right adjusted number
  //sprintf(tempString, "%4X", deciSecond); //Count in HEX, right adjusted

  //Produce an output on the display
  myDisplay.DisplayString(tempString, 0); //(numberToDisplay, decimal point location)

  //Other examples
  //myDisplay.DisplayString(tempString, 0); //Display string, no decimal point
  //myDisplay.DisplayString("-23b", 3); //Display string, decimal point in third position

  //Check if 10ms has elapsed
  if (millis() - timer >= 100)
  {
    timer = millis();
    deciSecond++;
  }

  delay(5);
}
User avatar
By redred
#181634
Hi together!

First of all: IT WORKS! Perfect!

But it wasn’t actually the code that was wrong because the scratch from scotta didn’t compile ether. So I had to look somewhere else and finally found the problem. My Arduino IDE was set to Adafruit Trinket / USBtinyUSP and not to Arduino UNO / Com1. And that was the problem. Two weeks ago, I tested something on the Trinket and changed those settings.

With correct settings, everything worked. Even my old scratch.

Regards,
Robert
User avatar
By Ross Robotics
#181638
lol, I love a scratch that works!