Code Monkey home page Code Monkey logo

vue-photon-voice's Introduction

Vue-Photon-Voice

Vue application built with VueJS and Web Speech API to recognize speech to text and send commands to Particle Photon device.

Live Demo

Particle Photon code in C++:

int style = 0;
LEDStatus status(RGB_COLOR_WHITE, LED_PATTERN_BLINK);

void setup() {
    status.setActive(true);
    status.setSpeed(LED_SPEED_SLOW);
    status.setPattern(LED_PATTERN_SOLID);
    Particle.function("colorMode",colorMode);
}

void loop() {
    switch(style) {
        case 0: status.setColor(RGB_COLOR_WHITE);
        break;
        case 1: status.setColor(RGB_COLOR_RED);
        break;
        case 2: status.setColor(RGB_COLOR_GREEN);
        break;
        case 3: status.setColor(RGB_COLOR_BLUE);
        break;
        case 4: status.setColor(RGB_COLOR_ORANGE);
        break;
        case 5: status.setColor(RGB_COLOR_YELLOW);
        break;
        case 6: status.setColor(RGB_COLOR_MAGENTA);
        break;
        case 7: {
            status.setPattern(LED_PATTERN_SOLID);
            status.setColor(RGB_COLOR_RED);
            delay(300);
            status.setColor(RGB_COLOR_ORANGE);
            delay(300);
            status.setColor(RGB_COLOR_YELLOW);
            delay(300);
            status.setColor(RGB_COLOR_GREEN);
            delay(300);
            status.setColor(RGB_COLOR_CYAN);
            delay(300);
            status.setColor(RGB_COLOR_BLUE);
            delay(300);
            status.setColor(RGB_COLOR_MAGENTA);
            delay(300);
        };
        break;
        case 8: status.setPattern(LED_PATTERN_SOLID);
        break;
        case 9: status.setPattern(LED_PATTERN_BLINK);
        break;
    }
}

int colorMode(String color) {
    if (color == "red") {
        style = 1;
    }
    else if (color == "green") {
        style = 2;
    }
        else if (color == "blue") {
        style = 3;
    }
    else if (color == "orange") {
        style = 4;
    }
    else if (color == "yellow") {
        style = 5;
    }
    else if (color == "magenta") {
        style = 6;
    }
    else if (color == "rainbow") {
        style = 7;
    }
    else if (color == "stop") {
        style = 8;
    }
    else if (color == "blink") {
        style = 9;
    }
    else if (color == "white") {
        style = 0;
    }
}

Project setup

yarn install

Compiles and hot-reloads for development

yarn run serve

Compiles and minifies for production

yarn run build

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.