このライブラリは1桁から8桁までのSeven segment Numeric LEDを制御します。 LEDはanode commonとcathode common を使用することができます。 LEDの表示は1秒で表示をスムースに切り替えるモードと、直ぐに切り替えるモードの2つのモードを選択することができます。 This library to control the Seven segment Numeric LED 8 digit of 1. You can use the LED cathode common and anode common. Switch mode LED display and a second displayed a smooth, you can choose two modes to switch modes quickly.
Dependents: kitchenTimer_Clock kitchenTimer LPC1114FN28_kitchenTimer_Clock SevenSegmentLedSample ... more
Diff: SevenSegLed.cpp
- Revision:
- 1:3429249e30f9
- Parent:
- 0:5410d6e2bce7
- Child:
- 3:f4680c84b347
- Child:
- 4:33e035f6a337
--- a/SevenSegLed.cpp Sun Nov 20 00:22:05 2011 +0000 +++ b/SevenSegLed.cpp Fri Dec 02 13:53:34 2011 +0000 @@ -15,9 +15,10 @@ /** Create a seven segment led object connected to the specified DigtalOutput pin */ -SevenSegLed::SevenSegLed(uint8_t commonPole, uint8_t smooth, PinName seg_a, PinName seg_b, PinName seg_c, PinName seg_d, PinName seg_e, PinName seg_f, PinName seg_g, PinName seg_p, PinName com_1, PinName com_2, PinName com_3, PinName com_4): +SevenSegLed::SevenSegLed(uint8_t commonPole, uint8_t smooth, PinName seg_a, PinName seg_b, PinName seg_c, PinName seg_d, PinName seg_e, PinName seg_f, PinName seg_g, PinName seg_p, + PinName com_1, PinName com_2, PinName com_3, PinName com_4, PinName com_5, PinName com_6, PinName com_7, PinName com_8): _seg_a(seg_a), _seg_b(seg_b), _seg_c(seg_c), _seg_d(seg_d), _seg_e(seg_e), _seg_f(seg_f), _seg_g(seg_g), _seg_p(seg_p), - _com_1(com_1), _com_2(com_2), _com_3(com_3), _com_4(com_4){ + _com_1(com_1), _com_2(com_2), _com_3(com_3), _com_4(com_4), _com_5(com_5), _com_6(com_6), _com_7(com_7), _com_8(com_8){ timer.attach_us(this, &SevenSegLed::segmentGrayDataKosin, 10000); // led smooth control 10ms timer inttruupt @@ -30,6 +31,10 @@ // check connect com_x D_comNull = Z_ketaSuu; + if(com_8 == NC){D_comNull--;} + if(com_7 == NC){D_comNull--;} + if(com_6 == NC){D_comNull--;} + if(com_5 == NC){D_comNull--;} if(com_4 == NC){D_comNull--;} if(com_3 == NC){D_comNull--;} if(com_2 == NC){D_comNull--;} @@ -165,9 +170,21 @@ void SevenSegLed::comAllClear(void){ switch (D_comNull){ - case 4: // com_1 - com_4 is all connect + case 8: // com_1 - com_8is all connect + _com_8 = D_commonOff; + //break; + case 7: // com_8 Null + _com_7 = D_commonOff; + //break; + case 6: // com_7 Null + _com_6 = D_commonOff; + //break; + case 5: // com_6 Null + _com_5 = D_commonOff; + //break; + case 4: // com_5 Null _com_4 = D_commonOff; - //break; + //break; case 3: // com_4 Null _com_3 = D_commonOff; // break; @@ -253,7 +270,19 @@ break; case 3: _com_4 = D_commonOn; - break; + break; + case 4: + _com_5 = D_commonOn; + break; + case 5: + _com_6 = D_commonOn; + break; + case 6: + _com_7 = D_commonOn; + break; + case 7: + _com_8 = D_commonOn; + break; default: break; }