add on off functions

This commit is contained in:
Xaloc 2020-03-13 17:25:31 +01:00
parent 92a0591b48
commit 6824ce9f3a
3 changed files with 18 additions and 0 deletions

View File

@ -10,3 +10,5 @@ seven KEYWORD2
eight KEYWORD2 eight KEYWORD2
nine KEYWORD2 nine KEYWORD2
dot KEYWORD2 dot KEYWORD2
on KEYWORD2
off KEYWORD2

View File

@ -96,3 +96,17 @@ void SegDisp::dot(int state)
digitalWrite(_pins[leds[i]], state); digitalWrite(_pins[leds[i]], state);
} }
} }
void SegDisp::on()
{
for (int i=0; i<8; i++){
digitalWrite(_pins[i], 1);
}
}
void SegDisp::off()
{
for (int i=0; i<8; i++){
digitalWrite(_pins[i], 0);
}
}

View File

@ -18,6 +18,8 @@ class SegDisp
void eight(int state); void eight(int state);
void nine(int state); void nine(int state);
void dot(int state); void dot(int state);
void on();
void off();
private: private:
int _pins[8]; int _pins[8];