1
0
mirror of https://github.com/s00500/SimpleExpressions synced 2024-11-21 12:50:54 +00:00

Merge branch 'master' into master

This commit is contained in:
Lukas Bachschwell 2017-12-16 20:11:15 +01:00 committed by GitHub
commit 95a7024a71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 121 additions and 110 deletions

View File

@ -5,7 +5,7 @@
{ {
"keys": "keys":
{ {
"LANG_CATEGORY_SOUND": "User Sound", "LANG_CATEGORY_SOUND": "Sound",
"LANG_SUBCATEGORY_BUZZER": "Buzzer", "LANG_SUBCATEGORY_BUZZER": "Buzzer",
"LANG_PIEZO_BUZZER": "Buzzer", "LANG_PIEZO_BUZZER": "Buzzer",
"LANG_PIEZO_BUZZER_PIN": "PIN", "LANG_PIEZO_BUZZER_PIN": "PIN",

View File

@ -1,5 +1,5 @@
name=SimpleExpressions name=SimpleExpressions
version=1.0.0 version=1.1.0
author=Lukas Bachschwell author=Lukas Bachschwell
maintainer=Lukas Bachschwell <lukas@lbsfilm.at> maintainer=Lukas Bachschwell <lukas@lbsfilm.at>
sentence=Make you Robots cute and noisy sentence=Make you Robots cute and noisy

View File

@ -25,9 +25,28 @@ Blockly.Blocks['show_mouth'] = {
tags: [], tags: [],
examples: [], examples: [],
init: function() { init: function() {
this.appendDummyInput('').appendField(Facilino.locales.getKey('LANG_SIMPLEEXPRESSIONS_SHOW_MOUTH')).appendField(new Blockly.FieldImage('img/blocks/round_led_strip.svg', 40*options.zoom, 40*options.zoom)); this.appendDummyInput('').appendField("WS2812 7-Ring").appendField(new Blockly.FieldImage('img/blocks/led_strip.svg', 40 * options.zoom, 40 * options.zoom));
this.appendValueInput('PIN').appendField(Facilino.locales.getKey('LANG_SIMPLEEXPRESSIONS_PIN')).setAlign(Blockly.ALIGN_RIGHT).setCheck(Number); this.appendValueInput('PIN').appendField(Facilino.locales.getKey('LANG_SIMPLEEXPRESSIONS_PIN')).setAlign(Blockly.ALIGN_RIGHT).setCheck(Number);
this.appendDummyInput('').appendField('Expression').appendField(new Blockly.FieldDropdown([['Zeros','zeros'],['Happy Small','happySmall'],['Happy Full','happyFull'],['Sad Small','sadSmall'],['Sad Full','sadFull'],['Neutral','neutral'],['Circle','circle'],['Center','center'],['Hook','hook'],['Upsidedown Hook','upsidedownhook'],['Kooh','kooh'],['Upsidedown Kooh','upsidedownkooh'],['Cross','cross'],['Rect','rect'],['Left Arrow','leftarrow'],['Right Arrow','rightarrow'],['Left Half','lefthalf'],['Right Half','righthalf']]),'EXPRESSION').setAlign(Blockly.ALIGN_RIGHT); this.appendDummyInput('').appendField('Expression').appendField(new Blockly.FieldDropdown([
['Zeros', 'zeros'],
['Happy Small', 'happySmall'],
['Happy Full', 'happyFull'],
['Sad Small', 'sadSmall'],
['Sad Full', 'sadFull'],
['Neutral', 'neutral'],
['Circle', 'circle'],
['Center', 'center'],
['Hook', 'hook'],
['Upsidedown Hook', 'upsidedownhook'],
['Kooh', 'kooh'],
['Upsidedown Kooh', 'upsidedownkooh'],
['Cross', 'cross'],
['Rect', 'rect'],
['Left Arrow', 'leftarrow'],
['Right Arrow', 'rightarrow'],
['Left Half', 'lefthalf'],
['Right Half', 'righthalf']
]), 'EXPRESSION').setAlign(Blockly.ALIGN_RIGHT);
var colour = new Blockly.FieldColour('#000000'); var colour = new Blockly.FieldColour('#000000');
colour.setColours(['#000000', '#808080', '#C0C0C0', '#FFFFFF', '#800000', '#FF0000', '#808000', '#FFFF00', '#008000', '#00FF00', '#008080', '#00FFFF', '#000080', '#0000FF', '#800080', '#FF00FF']).setColumns(4); colour.setColours(['#000000', '#808080', '#C0C0C0', '#FFFFFF', '#800000', '#FF0000', '#808000', '#FFFF00', '#008000', '#00FF00', '#008080', '#00FFFF', '#000080', '#0000FF', '#800080', '#FF00FF']).setColumns(4);
this.appendDummyInput('').appendField('Color').appendField(colour, 'COLOR').setAlign(Blockly.ALIGN_RIGHT); this.appendDummyInput('').appendField('Color').appendField(colour, 'COLOR').setAlign(Blockly.ALIGN_RIGHT);

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();
@ -37,7 +29,7 @@ void SimpleExpressionsClass::initBuzzer(int aBuzzerPin) {
//-- MOUTHS ----------------------------------------// //-- MOUTHS ----------------------------------------//
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
void SimpleExpressionsClass::writeMouth(char mouthName[], int r, int g, int b) { void SimpleExpressionsClass::writeMouth(const char mouthName[], int r, int g, int b) {
int number = -1; int number = -1;
for(int i = 0; i < frameCount; i++){ for(int i = 0; i < frameCount; i++){
if(strncmp(shapes[i].name, mouthName, 20) == 0) { if(strncmp(shapes[i].name, mouthName, 20) == 0) {
@ -62,7 +54,7 @@ void SimpleExpressionsClass::printMouth(int number, int r, int g, int b) {
clearPixels(); clearPixels();
} }
void SimpleExpressionsClass::writeMouth(char mouthName[] ) { void SimpleExpressionsClass::writeMouth(const char mouthName[] ) {
int number = -1; int number = -1;
for(int i = 0; i < colorFrameCount; i++){ for(int i = 0; i < colorFrameCount; i++){
if(strncmp(shapes[i].name, mouthName, 20) == 0) { if(strncmp(shapes[i].name, mouthName, 20) == 0) {

View File

@ -134,7 +134,7 @@
const int songspeed = 1; const int songspeed = 1;
const PROGMEM int notes[] = { //Note of the song, 0 is a rest/pulse const PROGMEM double notes[] = { //Note of the song, 0 is a rest/pulse
NOTE_E4, NOTE_G4, NOTE_A4, NOTE_A4, 0, NOTE_E4, NOTE_G4, NOTE_A4, NOTE_A4, 0,
NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0, NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0,
NOTE_C5, NOTE_D5, NOTE_B4, NOTE_B4, 0, NOTE_C5, NOTE_D5, NOTE_B4, NOTE_B4, 0,