1
0
mirror of https://github.com/s00500/SimpleExpressions synced 2024-11-21 18:00:55 +00:00

fixing init methods

This commit is contained in:
Lukas Bachschwell 2017-12-11 15:09:49 +01:00
parent 1898615bab
commit ea9fabe9a4
2 changed files with 6 additions and 14 deletions

View File

@ -4,21 +4,13 @@
#define ledc_channel 5 #define ledc_channel 5
void SimpleExpressionsClass::init(int aMouthPin, int aBuzzerPin) { void SimpleExpressionsClass::init(int aMouthPin, int aBuzzerPin) {
mouth = Adafruit_NeoPixel(7, aMouthPin, NEO_GRB + NEO_KHZ800); initMouth(aMouthPin);
mouth.begin(); initBuzzer(aBuzzerPin);
buzzerPin = aBuzzerPin;
#if defined(ESP32)
ledcSetup(ledc_channel, 2000, 8); // channel, max frequency, resolution
ledcAttachPin(aBuzzerPin, ledc_channel);
#endif
clearMouth(); clearMouth();
} }
void SimpleExpressionsClass::init(int aMouthPin, int aBuzzerPin) {
void SimpleExpressionsClass::initMouth(int aMouthPin) {
mouth = Adafruit_NeoPixel(7, aMouthPin, NEO_GRB + NEO_KHZ800); mouth = Adafruit_NeoPixel(7, aMouthPin, NEO_GRB + NEO_KHZ800);
mouth.begin(); mouth.begin();
clearMouth(); clearMouth();

View File

@ -16,8 +16,8 @@ class SimpleExpressionsClass
public: public:
// General // General
void init(int mouthPin, int buzzerPin); void init(int mouthPin, int buzzerPin);
void initMouth(int mouthPin); void initMouth(int mouthPin);
void initBuzzer(int buzzerPin); void initBuzzer(int buzzerPin);
// Mouths // Mouths
void printMouth(int number, int r, int g, int b); void printMouth(int number, int r, int g, int b);