mirror of
https://github.com/s00500/SimpleExpressions
synced 2024-11-21 18:00:55 +00:00
restructure mouth loading
This commit is contained in:
parent
9756b21923
commit
6881c48636
92
Shapes.h
92
Shapes.h
@ -1,6 +1,10 @@
|
||||
#ifndef Shapes_h
|
||||
#define Shapes_h
|
||||
|
||||
//***********************************************************************************
|
||||
//*********************************MOUTHS DEFINES************************************
|
||||
//***********************************************************************************
|
||||
|
||||
|
||||
const int zeros[7][3] = {
|
||||
{0,0,0},
|
||||
@ -22,84 +26,22 @@ const int happySimple[7][3] = {
|
||||
{0,0,0},
|
||||
};
|
||||
|
||||
//***********************************************************************************
|
||||
//*********************************MOUTHS DEFINES************************************
|
||||
//***********************************************************************************
|
||||
|
||||
#define zero_code 0b00001100010010010010010010001100
|
||||
#define one_code 0b00000100001100000100000100001110
|
||||
#define two_code 0b00001100010010000100001000011110
|
||||
#define three_code 0b00001100010010000100010010001100
|
||||
#define four_code 0b00010010010010011110000010000010
|
||||
#define five_code 0b00011110010000011100000010011100
|
||||
#define six_code 0b00000100001000011100010010001100
|
||||
#define seven_code 0b00011110000010000100001000010000
|
||||
#define eight_code 0b00001100010010001100010010001100
|
||||
#define nine_code 0b00001100010010001110000010001110
|
||||
|
||||
#define smile_code 0b00000000100001010010001100000000
|
||||
#define happyOpen_code 0b00000000111111010010001100000000
|
||||
#define happyClosed_code 0b00000000111111011110000000000000
|
||||
#define heart_code 0b00010010101101100001010010001100
|
||||
|
||||
#define bigSurprise_code 0b00001100010010100001010010001100
|
||||
#define smallSurprise_code 0b00000000000000001100001100000000
|
||||
|
||||
#define tongueOut_code 0b00111111001001001001000110000000
|
||||
#define vamp1_code 0b00111111101101101101010010000000
|
||||
#define vamp2_code 0b00111111101101010010000000000000
|
||||
#define lineMouth_code 0b00000000000000111111000000000000
|
||||
|
||||
#define confused_code 0b00000000001000010101100010000000
|
||||
#define diagonal_code 0b00100000010000001000000100000010
|
||||
|
||||
#define sad_code 0b00000000001100010010100001000000
|
||||
#define sadOpen_code 0b00000000001100010010111111000000
|
||||
#define sadClosed_code 0b00000000001100011110110011000000
|
||||
|
||||
#define okMouth_code 0b00000001000010010100001000000000
|
||||
#define xMouth_code 0b00100001010010001100010010100001
|
||||
#define interrogation_code 0b00001100010010000100000100000100
|
||||
|
||||
#define thunder_code 0b00000100001000011100001000010000
|
||||
#define culito_code 0b00000000100001101101010010000000
|
||||
|
||||
#define angry_code 0b00000000011110100001100001000000
|
||||
const int testing[7][3] = {
|
||||
{0,0,0},
|
||||
{0,150,0},
|
||||
{0,150,0},
|
||||
{0,150,0},
|
||||
{0,150,0},
|
||||
{0,0,0},
|
||||
{0,0,0},
|
||||
};
|
||||
|
||||
|
||||
//Mouths sorted by numbers, and after, by happy to sad mouths
|
||||
#define zero 0
|
||||
#define one 1
|
||||
#define two 2
|
||||
#define three 3
|
||||
#define four 4
|
||||
#define five 5
|
||||
#define six 6
|
||||
#define seven 7
|
||||
#define eight 8
|
||||
#define nine 9
|
||||
#define smile 10
|
||||
#define happyOpen 11
|
||||
#define happyClosed 12
|
||||
#define heart 13
|
||||
#define bigSurprise 14
|
||||
#define smallSurprise 15
|
||||
#define tongueOut 16
|
||||
#define vamp1 17
|
||||
#define vamp2 18
|
||||
#define lineMouth 19
|
||||
#define confused 20
|
||||
#define diagonal 21
|
||||
#define sad 22
|
||||
#define sadOpen 23
|
||||
#define sadClosed 24
|
||||
#define okMouth 25
|
||||
#define xMouth 26
|
||||
#define interrogation 27
|
||||
#define thunder 28
|
||||
#define culito 29
|
||||
#define angry 30
|
||||
//giving all moths a unique ID
|
||||
|
||||
#define M_ZERO 0
|
||||
#define M_HAPPY_SIMPLE 1
|
||||
#define M_TESTING 2
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
#include "Shapes.h"
|
||||
|
||||
|
||||
|
||||
class SimpleExpressionsClass
|
||||
{
|
||||
public:
|
||||
@ -16,10 +14,13 @@ class SimpleExpressionsClass
|
||||
void init(int mouthPin, int buzzerPin);
|
||||
|
||||
void writeMouth(int mouth);
|
||||
void putMouth(unsigned long int mouth, bool predefined = true);
|
||||
void putAnimationMouth(unsigned long int anim, int index);
|
||||
void clearMouth();
|
||||
|
||||
void writeMouthRecolored(int mouth, u_int32 color);
|
||||
void writeMouthGeneric(int[7][3] mouthArray);
|
||||
|
||||
void putAnimationMouth(unsigned long int anim, int index);
|
||||
|
||||
//-- Sounds
|
||||
void _tone (float noteFrequency, long noteDuration, int silentDuration);
|
||||
void bendTones (float initFrequency, float finalFrequency, float prop, long noteDuration, int silentDuration);
|
||||
@ -33,12 +34,9 @@ class SimpleExpressionsClass
|
||||
Adafruit_NeoPixel mouth;
|
||||
|
||||
int pinBuzzer;
|
||||
int pinMouth;
|
||||
|
||||
unsigned long int getMouthShape(int number);
|
||||
unsigned long int getAnimShape(int anim, int index);
|
||||
void _execute(int A[4], int O[4], int T, double phase_diff[4], float steps);
|
||||
|
||||
};
|
||||
|
||||
extern SimpleExpressionsClass SimpleExpressions;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <SimpleExpressions.h>
|
||||
|
||||
void setup() {
|
||||
SimpleExpressions.init(13,14);
|
||||
SimpleExpressions.init(13, 14);
|
||||
SimpleExpressions.writeMouth();
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user