mirror of
https://github.com/s00500/SimpleExpressions
synced 2024-12-29 11:15:47 +00:00
Working as normal
This commit is contained in:
parent
e3d6ae422b
commit
29762e3852
14
Shapes.h
14
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
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user