From 29762e385204702226448ae68310c182a4307c7f Mon Sep 17 00:00:00 2001 From: Lukas Bachschwell Date: Wed, 22 Nov 2017 16:20:14 +0100 Subject: [PATCH] Working as normal --- Shapes.h | 14 +++++++------- SimpleExpressions.cpp | 16 +++++++++++----- SimpleExpressions.h | 3 +-- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Shapes.h b/Shapes.h index 69bbd5f..71a85ef 100755 --- a/Shapes.h +++ b/Shapes.h @@ -14,7 +14,7 @@ typedef Frame; #define shapeNumber 5 // add the current shape count here // and don't make names longer than 20! -const PROGMEM Frame shapes[] = { +const Frame shapes[] = { { "zeros", { @@ -24,7 +24,7 @@ const PROGMEM Frame shapes[] = { {0,0,0}, {0,0,0}, {0,0,0}, - {0,0,0}, + {0,0,0} } }, { @@ -36,7 +36,7 @@ const PROGMEM Frame shapes[] = { {0,150,0}, {0,0,0}, {0,0,0}, - {0,0,0}, + {0,0,0} } }, { @@ -48,7 +48,7 @@ const PROGMEM Frame shapes[] = { {0,150,0}, {0,150,0}, {0,0,0}, - {0,0,0}, + {0,0,0} } }, { @@ -60,7 +60,7 @@ const PROGMEM Frame shapes[] = { {0, 0, 0}, {0, 0, 0}, {0, 150,0}, - {0, 150,0}, + {0, 150,0} } }, { @@ -72,8 +72,8 @@ const PROGMEM Frame shapes[] = { {0,0,0}, {0,150,0}, {0,150,0}, - {0,150,0}, + {0,150,0} } - }, + } }; #endif diff --git a/SimpleExpressions.cpp b/SimpleExpressions.cpp index 432ab26..b5ecf1d 100755 --- a/SimpleExpressions.cpp +++ b/SimpleExpressions.cpp @@ -34,20 +34,21 @@ void SimpleExpressionsClass::writeMouth(unsigned int mouthId){ } */ + void SimpleExpressionsClass::writeMouth(char mouthName[] ){ int number = -1; for(int i = 0; i < shapeNumber; i++){ // perform on first encounter - Serial.print("aname: "); - Serial.println(shapes[i].name); - if(strcmp(shapes[i].name, mouthName) == 0) { - Serial.println("match"); + //Serial.print("aname: "); + if(strncmp(shapes[i].name, mouthName, 20) == 0) { + //Serial.print("####################match "); + //Serial.println(shapes[i].name); number = i; break; } } if(number != -1){ - writeMouthGeneric(shapes[number].data); + printMouthShape(number); } else { if(debug) Serial.println("Error: mouth name does not exist"); } @@ -61,10 +62,15 @@ void SimpleExpressionsClass::printMouthShape(int number) { } + void SimpleExpressionsClass::writeMouthGeneric(const int mouthArray[7][3]) { for(uint16_t i=0; i<7; i++) { mouth.setPixelColor(i, mouth.Color(mouthArray[i][0], mouthArray[i][1], mouthArray[i][2])); } + for(uint16_t i = 0; i<7; i++) { + Serial.println(mouth.getPixelColor(i)); + } + Serial.println("#############"); mouth.show(); } diff --git a/SimpleExpressions.h b/SimpleExpressions.h index eaa4781..f2de401 100755 --- a/SimpleExpressions.h +++ b/SimpleExpressions.h @@ -36,9 +36,8 @@ class SimpleExpressionsClass private: - Adafruit_NeoPixel mouth; - int pinBuzzer; + Adafruit_NeoPixel mouth; long int getMouthShape(int number); long int getAnimShape(int anim, int index);