Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Seven seg matrix.drawColon(true)
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Seven seg matrix.drawColon(true)

by Perceus26 on Fri Jan 22, 2016 11:21 am

It wont work! I have a 0.56 in seven seg and the colon wont work! plz help! I have also tried to use matrix.writeDigitRaw(2, 2); but it didn't work! I cant have a clock without the colon! plz help!

Perceus26
 
Posts: 3
Joined: Fri Jan 22, 2016 11:18 am

Re: Seven seg matrix.drawColon(true)

by Perceus26 on Fri Jan 22, 2016 11:29 am

I need it as soon as possible! cause im losin power in about 5 hours! Here is my code:
Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
Adafruit_7segment matrix = Adafruit_7segment();

int h10s = 0;
int h1s = 0;
int m10s = 0;
int m1s = 0;
int s = 0;
int modeButton = 13;
int hourButton = 12;
int minButton = 11;
int mode = 0;
/*int speaker = 10;
int a1h1s = -1;
int a1h10s = -1;
int a1m1s = -1;
int a1m10s = -1;
int speak = 0;*/

void setup()
{
 matrix.begin(0x70);
 Serial.begin(9600);
 pinMode(modeButton, INPUT);
 pinMode(hourButton, INPUT);
 pinMode(minButton, INPUT);
 //pinMode(speaker, OUTPUT);
}

void loop() {
//mode button
 if(digitalRead(modeButton) == HIGH) {
   if(mode != 2)
     mode++;
   else
     mode = 0;
 }



//clock

 else {
  delay(250);
  s++;
  if(s == 240)
  {
    m1s++;
    s = 0;
  }
  if(m1s==10)
  {
   m10s++;
   m1s = 0;
  }
  if(m10s == 6)
  {
   h1s++;
   m10s = 0;
  }
  if(h1s == 10)
  {
   h10s++;
   h1s = 0;
  }
  if(h10s == 2 && h1s == 4)
  {
   h10s = 0;
   h1s = 0;
  }
  matrix.writeDisplay();
  matrix.writeDigitRaw(2, 2);
  matrix.writeDigitNum(0, h10s);
  matrix.writeDigitNum(1, h1s);
  matrix.writeDigitNum(3, m10s);
  matrix.writeDigitNum(4, m1s);
  matrix.setBrightness(1);
  }
 
  //if(a1h10s == h10s && a1h1s == h1s && a1m10s == m10s && a1m1s == m1s) {
    //digitalWrite(speaker, HIGH);
    //speak = s + 8;
  //}
//}




//clock set
if(mode == 1) {
    matrix.writeDisplay();
    matrix.writeDigitRaw(2, 2);
    matrix.setBrightness(1);
    matrix.writeDigitNum(0, h10s, true);
    matrix.writeDigitNum(1, h1s);
    matrix.writeDigitNum(3, m10s);
    matrix.writeDigitNum(4, m1s);
    if(digitalRead(hourButton) == HIGH)
      h1s=h1s+1;
    if(digitalRead(minButton) == HIGH)
      m1s=m1s+1;
     
    if(m1s==10)
    {
      m10s++;
      m1s = 0;
    }
   if(m10s == 6)
   {
     m10s = 0;
   }
   if(h1s == 10)
   {
     h10s++;
     h1s = 0;
   }
   if(h10s == 2 && h1s == 4)
   {
     h10s = 0;
     h1s = 0;
   }
}
}

Perceus26
 
Posts: 3
Joined: Fri Jan 22, 2016 11:18 am

Re: Seven seg matrix.drawColon(true)

by Perceus26 on Fri Jan 22, 2016 11:32 am

I purposely commented out some things fyi and my project needs to be done by February 13

Perceus26
 
Posts: 3
Joined: Fri Jan 22, 2016 11:18 am

Please be positive and constructive with your questions and comments.