Add function to shiftout n size numbers instead of just bytes
This commit is contained in:
parent
f771f86e7f
commit
fd76bd7de9
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
int toDice(int n);
|
int toDice(int n);
|
||||||
unsigned long int shift(int* numbers);
|
unsigned long int shift(int* numbers);
|
||||||
|
void ShiftNOut(unsigned long int value, byte n)
|
||||||
|
|
||||||
uint8_t dicerolls[DICEN];
|
uint8_t dicerolls[DICEN];
|
||||||
|
|
||||||
@ -53,9 +54,7 @@ void loop() {
|
|||||||
dicerolls[4] = random(1, 7);
|
dicerolls[4] = random(1, 7);
|
||||||
}
|
}
|
||||||
unsigned long int result = shift(dicerolls)
|
unsigned long int result = shift(dicerolls)
|
||||||
/*shiftOut(result >> 16);
|
ShiftNOut(result, sizeof(long))
|
||||||
shiftOut(result >> 8);
|
|
||||||
shiftOut(result);*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,3 +103,10 @@ unsigned long int shift(int* numbers) {
|
|||||||
|
|
||||||
return shiftn; /* End result is a number representing your data outputs for all DICEN */
|
return shiftn; /* End result is a number representing your data outputs for all DICEN */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShiftNOut(unsigned long int value, byte n) {
|
||||||
|
n = n/sizeof(byte);
|
||||||
|
for (byte i = 0; i < n; i++) {
|
||||||
|
ShiftOut(value >> sizeof(byte)*i)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user