Go Down

Topic: Shiftout a byte (Read 624 times) previous topic - next topic

stoopkid

Im defining my bytes like this:

Code: [Select]
byte digit[10][7]={{1,1,1,1,1,1,0},//0
                  {0,1,1,0,0,0,0},//1
                  {1,1,0,1,1,0,1},//2
                  {1,1,1,1,0,0,1},//3
                  {0,1,1,0,0,1,1},//4
                  {1,0,1,1,0,1,1},//5
                  {1,0,1,1,1,1,1},//6
                  {1,1,1,0,0,0,0},//7
                  {1,1,1,1,1,1,1},//8
                  {1,1,1,1,0,1,1}};//9


but this doesnt work:
Code: [Select]
shiftOut(dataPin, clockPin, MSBFIRST, digit[numb]);

How do i convert the bytes to an int?

robtillaart


You better use the individual bits in the byte

byte digit[10][7]={{1,1,1,1,1,1,0},//0
                  {0,1,1,0,0,0,0},//1
                  {1,1,0,1,1,0,1},//2
                  {1,1,1,1,0,0,1},//3
                  {0,1,1,0,0,1,1},//4
                  {1,0,1,1,0,1,1},//5
                  {1,0,1,1,1,1,1},//6
                  {1,1,1,0,0,0,0},//7
                  {1,1,1,1,1,1,1},//8
                  {1,1,1,1,0,1,1}};//9

becomes
byte digits[10] = { B01111110, B00110000, B01101101, B01111001, B00110011, B01011011 etc

Then the shift should work. (also take only 10 bytes of RAM iso 70)

succes,
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

stoopkid

thanks, that worked except i had to put the 0's at the end and change it to LSBFIRST... i guess just from how i wired it.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy