SHARE
TWEET

Untitled

a guest Jun 20th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void getStellen()
  2. {
  3.     Timer = TCNT1;
  4.     int tempNum;
  5.    
  6.     CurrentRPM = (60.0 * 14745600)/(256 * (float)Timer);
  7.     Tausender = (int)CurrentRPM / 1000;
  8.     tempNum   = (int)CurrentRPM - (Tausender * 1000);
  9.     Hunderter = tempNum / 100;
  10.     tempNum   = tempNum - (Hunderter * 100);
  11.     Zehner    = tempNum /  10;
  12.     tempNum   = tempNum - (Zehner * 10);
  13.     Einer     = tempNum;
  14.    
  15.     int j = SegmentCounter;
  16.    
  17.     if      (j >= 0 && j <  6) setNumberToArray(Tausender,  0, j);
  18.     else if (j > 14 && j < 21) setNumberToArray(Hunderter, 15, j);
  19.     else if (j > 30 && j < 36) setNumberToArray(Zehner, 31, j);
  20.     else if (j > 45 && j < 52) setNumberToArray(Einer,  46, j);
  21.     else if (j > 61 && j < 69) for (int i = 3; i < 12; i++) setLed(i, 0x0F*Letter_M[i][j - 62], 0, 0, 255);
  22.     else if (j > 72 && j < 77) for (int i = 3; i < 12; i++) setLed(i, 0x0F*Letter_P[i][j - 73], 0, 255, 0);
  23.     else if (j > 80 && j < 89) for (int i = 3; i < 12; i++) setLed(i, 0x0F*Letter_R[i][j - 81], 255, 0, 0);
  24.     else initarray();
  25.    
  26.     sendframe();
  27. }
  28.  
  29.  
  30. void setNumberToArray(int zahl, int segment, int j)
  31. {
  32.    
  33.     switch(zahl)
  34.     {
  35.         case 0:
  36.         for (int i = 3; i < 12; i++) setLed(i, 0x0F*Zahl_0[i][SegmentCounter - segment], 0, 0, 255);
  37.         break;
  38.        
  39.         case 1:
  40.         for (int i = 3; i < 12; i++) setLed(i, 0x0F*Zahl_1[i][SegmentCounter - segment], 0, 0, 255);
  41.         break;
  42.        
  43.         case 2:
  44.         for (int i = 3; i < 12; i++) setLed(i, 0x0F*Zahl_2[i][SegmentCounter - segment], 0, 0, 255);
  45.         break;
  46.        
  47.         case 3:
  48.         for (int i = 3; i < 12; i++) setLed(i, 0x0F*Zahl_3[i][SegmentCounter - segment], 0, 0, 255);
  49.         break;
  50.        
  51.         case 4:
  52.         for (int i = 3; i < 12; i++) setLed(i, 0x0F*Zahl_4[i][SegmentCounter - segment], 0, 0, 255);
  53.         break;
  54.        
  55.         case 5:
  56.         for (int i = 3; i < 12; i++) setLed(i, 0x0F*Zahl_5[i][SegmentCounter - segment], 0, 0, 255);
  57.         break;
  58.        
  59.         case 6:
  60.         for (int i = 3; i < 12; i++) setLed(i, 0x0F*Zahl_6[i][SegmentCounter - segment], 0, 0, 255);
  61.         break;
  62.        
  63.         case 7:
  64.         for (int i = 3; i < 12; i++) setLed(i, 0x0F*Zahl_7[i][SegmentCounter - segment], 0, 0, 255);
  65.         break;
  66.        
  67.         case 8:
  68.         for (int i = 3; i < 12; i++) setLed(i, 0x0F*Zahl_8[i][SegmentCounter - segment], 0, 0, 255);
  69.         break;
  70.        
  71.         case 9:
  72.         for (int i = 3; i < 12; i++) setLed(i, 0x0F*Zahl_9[i][SegmentCounter - segment], 0, 0, 255);
  73.         break;
  74.        
  75.     }
  76. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top