Pages: [1]   Go Down
Author Topic: Shiftout a byte  (Read 500 times)
0 Members and 1 Guest are viewing this topic.
California
Offline Offline
Sr. Member
****
Karma: 3
Posts: 433
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Im defining my bytes like this:

Code:
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:
shiftOut(dataPin, clockPin, MSBFIRST, digit[numb]);

How do i convert the bytes to an int?
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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,
Logged

Rob Tillaart

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

California
Offline Offline
Sr. Member
****
Karma: 3
Posts: 433
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: