Hi
So I made a little project with 4 - 7 segment Display 4" (For every display I had to use the sparkfun large digit driver ofc!) and I've use a gyroscope to hold track of the rotation, every time when it has rotated for 360 degrees it increments the counter and it shows on the display.
This project is running on a battery of 50.000mAh, a.t.m I'm trying to reduce battery (project needs to run at least a week without changing battery). So I was thinking to turn off the displays when the gyro is not rotating. I programmed it, working well but there is 1 problem. Every time I clear the segments (when the gyro is not rotating) one of my sparkfun large digit driver IC gets very warm. I've use the showNumber function to check if the IC still gets hot but that doesn't happen. This problem is only happening when I clear the segments >.>
This the code That I've been using:
My clearSegments function
void clearSegments() {
for (byte x = 0 ; x < 4 ; x++) {
postNumber(" ", false);
}
digitalWrite(segmentLatch, LOW);
digitalWrite(segmentLatch, HIGH);
}
The postnumber function
void postNumber(byte number, boolean decimal)
{
#define a 1<<0
#define b 1<<6
#define c 1<<5
#define d 1<<4
#define e 1<<3
#define f 1<<1
#define g 1<<2
#define dp 1<<7
byte segments;
switch (number)
{
case 1: segments = g | d; break;
case 2: segments = f | g | b | dp | c; break;
case 3: segments = f | g | b | d | c; break;
case 4: segments = a | b | g | d; break;
case 5: segments = f | a | b | d | c; break;
case 6: segments = f | a | b | d | c | dp; break;
case 7: segments = f | g | d; break;
case 8: segments = a | b | c | d | dp | f | g; break;
case 9: segments = a | b | c | d | f | g; break; // a | b | c | d | f | g; break
case 0: segments = a | g | c | d | dp | f; break;
case ' ': segments = 0; break;
}
// Segments not working on 0
if (decimal) segments |= e;
//Clock these bits out to the drivers
for (byte x = 0 ; x < 8 ; x++)
{
digitalWrite(segmentClock, LOW);
digitalWrite(segmentData, segments & 1 << (7 - x));
digitalWrite(segmentClock, HIGH); //Data transfers to the register on the rising edge of SRCK
}
}
I hope you guys have an idea what I'm doing wrong and how to solve this.
Thank you very much!