Hello everyone,
I have a code running correctly on my Arduino that count over 5 seven segment displays using a library. Can someone help me to format this code so it can run micropython?
I can understand that the library that i have include will oppose a problem but is there an equivalent for micropython or is it possible rebuild it without a library?
I've posted here after searching on websites to find information also looked for tutorials for shift registers without success.
I hope to hear from you soon.
#include <ShiftRegister74HC595.h>
// create shift register object (number of shift registers, data pin, clock pin, latch pin)
ShiftRegister74HC595<2> sr (6, 4, 5);
unsigned long countnumber;
int firstnum=0;
int secondnum=0;
int thirdnum=0;
int fournum=0;
int fivenum=0;
int sixnum=0;
int sevennum=0;
int eightnum=0;
int value,digit1,digit2,digit3,digit4;
uint8_t digits[] = { B10111111, //0 Order is dp g f e d c b a
B10000110, //1
B01011011, //2
B11001111, //3
B11100110, //4
B11101101, //5
B11111101, //6
B10000111, //7
B11111111, //8
B11101111 //9
};
void setup() {
Serial.begin(115200);
}
void incrementer () {
countnumber = millis();
firstnum = countnumber / 10000000 % 10;
secondnum = countnumber / 1000000 % 10;
thirdnum = countnumber / 100000 % 10;
fournum = countnumber / 10000 % 10;
fivenum = countnumber / 1000 % 10;
sixnum = countnumber / 100 % 10;
sevennum = countnumber / 10 % 10;
eightnum = countnumber % 10;
uint8_t numberToPrint[]= {digits[sixnum],digits[fivenum]};
sr.setAll(numberToPrint);
}
void showNumber(int num)
{
digit4 = num % 10 ;
digit3 = (num / 10) % 10 ;
digit2 = (num / 100) % 10 ;
digit1 = (num / 1000) % 10 ;
fournum = (num / 10000) % 10;
//Send them to 7 segment displays
uint8_t numberToPrint[]= {digits[digit1],digits[fournum]};
sr.setAll(numberToPrint);
}
void loop() {
incrementer();
//showNumber(1316);
}






