hello,
i decide to make a thermometer project!i have a problem with the code.i see random segments light up but dont make the numbers that i wand
const byte COL_COUNT = 100;
unsigned int sequence[COL_COUNT] = {/*
1234567812345678*/
0B1111110011111100,//00
0B0110000011111100,
0B1101101011111100,
0B1111001011111100,
0B0110011011111100,
0B1011011011111100,
0B1011111011111100,
0B1110000011111100,
0B1111111011111100,
0B1111011011111100,//09
0B1111110001100000,//10
0B0110000001100000,
0B1101101001100000,
0B1111001001100000,
0B0110011001100000,
0B1011011001100000,
0B1011111001100000,
0B1110000001100000,
0B1111111001100000,
0B1111011001100000,//19
0B1111110011011010,//20
0B0110000011011010,
0B1101101011011010,
0B1111001011011010,
0B0110011011011010,
0B1011011011011010,
0B1011111011011010,
0B1110000011011010,
0B1111111011011010,
0B1111011011011010,//29
0B1111110011110010,//30
0B0110000011110010,
0B1101101011110010,
0B1111001011110010,
0B0110011011110010,
0B1011011011110010,
0B1011111011110010,
0B1110000011110010,
0B1111111011110010,
0B1111011011110010,//39
0B1111110001100110,//40
0B0110000001100110,
0B1101101001100110,
0B1111001001100110,
0B0110011001100110,
0B1011011001100110,
0B1011111001100110,
0B1110000001100110,
0B1111111001100110,
0B1111011001100110,//49
0B1111110010110110,//50
0B0110000010110110,
0B1101101010110110,
0B1111001010110110,
0B0110011010110110,
0B1011011010110110,
0B1011111010110110,
0B1110000010110110,
0B1111111010110110,
0B1111011010110110,//59
0B1111110010111110,//60
0B0110000010111110,
0B1101101010111110,
0B1111001010111110,
0B0110011010111110,
0B1011011010111110,
0B1011111010111110,
0B1110000010111110,
0B1111111010111110,
0B1111011010111110,//69
0B1111110011100000,//70
0B0110000011100000,
0B1101101011100000,
0B1111001011100000,
0B0110011011100000,
0B1011011011100000,
0B1011111011100000,
0B1110000011100000,
0B1111111011100000,
0B1111011011100000,//79
0B1111110011111110,//80
0B0110000011111110,
0B1101101011111110,
0B1111001011111110,
0B0110011011111110,
0B1011011011111110,
0B1011111011111110,
0B1110000011111110,
0B1111111011111110,
0B1111011011111110,//89
0B1111110011110110,//90
0B0110000011110110,
0B1101101011110110,
0B1111001011110110,
0B0110011011110110,
0B1011011011110110,
0B1011111011110110,
0B1110000011110110,
0B1111111011110110,
0B1111011011110110,//99
};
int latchPin = 8; //Pin connected to ST_CP(pin 12) of 74HC595
int clockPin = 12; //Pin connected to SH_CP(pin 11) of 74HC595
int dataPin = 11; //Pin connected to DS(pin 14) of 74HC595
int s1 = A0; //sensor pin
void setup() {
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
//sensor pins
pinMode(s1, INPUT);
Serial.begin(9600);
}
void loop()
{
int sa = round(map(analogRead(s1), 0, 1023, 100, 0));
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, (sequence[sa] >> 8)); //shift out highbyte
shiftOut(dataPin, clockPin, LSBFIRST,sequence[sa]); //shift out lowbyte
digitalWrite(latchPin, HIGH);
Serial.print(sequence[sa]);Serial.print(",");Serial.println(sa);
delay(200);
}
i try to make it with binary.the wiring is this:
Can you help me to just make it count from 0 to 100? Thanks