Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Cube/LedCube.cpp
- Revision:
- 4:a091b8f8216d
- Parent:
- 3:da30c350c339
- Child:
- 5:e4ed6c5baf89
--- a/Cube/LedCube.cpp Fri May 02 18:26:40 2014 +0000
+++ b/Cube/LedCube.cpp Sun May 04 20:41:10 2014 +0000
@@ -7,11 +7,23 @@
layer_current=0;
rank_current=0;
layer_oneHot=1;
+
+ clearValues();
}
LedCube::~LedCube(){
}
+void LedCube::clearValues(){
+ for(int i = 0; i < 8; i++){
+ for(int j = 0; j < 8; j++){
+ rValues[i][j] = 0;
+ gValues[i][j] = 0;
+ bValues[i][j] = 0;
+ }
+ }
+}
+
//return the next byte of data to send
char LedCube::getNextValue(){
@@ -110,7 +122,7 @@
void LedCube::printrValues(){
for(int i = 0; i < 8; i ++){
for(int j = 0; j < 8; j++){
- printf("%d ", rValues[i][j]);
+ printf("%03d ", rValues[i][j]);
}
printf("\n\r");
}
@@ -119,7 +131,7 @@
void LedCube::printgValues(){
for(int i = 0; i < 8; i ++){
for(int j = 0; j < 8; j++){
- printf("%d ", gValues[i][j]);
+ printf("%03d ", gValues[i][j]);
}
printf("\n\r");
}
@@ -128,7 +140,7 @@
void LedCube::printbValues(){
for(int i = 0; i < 8; i ++){
for(int j = 0; j < 8; j++){
- printf("%d ", bValues[i][j]);
+ printf("%03d ", bValues[i][j]);
}
printf("\n\r");
}