Someone Please Check My Code
could please tell me coding errors in code? have downloaded code newly purchased dmd freetronics , don't know how program dmd's.
code: [select]
switch(hour)
{
case 1:
dmd.drawstring( 1,8, "01", 2, graphics_normal );
break;
case 2:
dmd.drawstring( 1,8, "02", 2, graphics_normal );
break;
case 3:
dmd.drawstring( 1,8, "03", 2, graphics_normal );
break;
case 4:
dmd.drawstring( 1,8, "04", 2, graphics_normal );
break;
case 5:
dmd.drawstring( 1,8, "05", 2, graphics_normal );
break;
case 6:
dmd.drawstring( 1,8, "06", 2, graphics_normal );
break;
case 7:
dmd.drawstring( 1,8, "07", 2, graphics_normal );
break;
case 8:
dmd.drawstring( 1,8, "08", 2, graphics_normal );
break;
case 9:
dmd.drawstring( 1,8, "09", 2, graphics_normal );
break;
case 10:
dmd.drawstring( 1,8, "10", 2, graphics_normal );
break;
case 11:
dmd.drawstring( 1,8, "11", 2, graphics_normal );
break;
case 12:
dmd.drawstring( 1,8, "12", 2, graphics_normal );
break;
case 13:
dmd.drawstring( 1,8, "13", 2, graphics_normal );
break;
case 14:
dmd.drawstring( 1,8, "14", 2, graphics_normal );
break;
case 15:
dmd.drawstring( 1,8, "15", 2, graphics_normal );
break;
case 16:
dmd.drawstring( 1,8, "16", 2, graphics_normal );
break;
case 17:
dmd.drawstring( 1,8, "17", 2, graphics_normal );
break;
case 18:
dmd.drawstring( 1,8, "18", 2, graphics_normal );
break;
case 19:
dmd.drawstring( 1,8, "19", 2, graphics_normal );
break;
case 20:
dmd.drawstring( 1,8, "20", 2, graphics_normal );
break;
case 21:
dmd.drawstring( 1,8, "21", 2, graphics_normal );
break;
case 22:
dmd.drawstring( 1,8, "22", 2, graphics_normal );
break;
case 23:
dmd.drawstring( 1,8, "23", 2, graphics_normal );
break;
case 24:
dmd.drawstring( 1,8, "24", 2, graphics_normal );
break;
seems me long-winded way of writing
code: [select]
char buffer [3];
sprintf (buffer, "%02d", hour);
dmd.drawstring( 1,8, buffer, 2, graphics_normal );
Arduino Forum > Using Arduino > Programming Questions > Someone Please Check My Code
arduino
Comments
Post a Comment