Things used in this project

Hardware components:
Echo
Amazon Alexa Amazon Echo
Or any other Alexa enabled device.
×1
Software apps and online services:
Screen%20shot%202015 07 20%20at%206.10.26%20pm
Amazon Web Services AWS Lambda
Dp image kit 02
Amazon Alexa Alexa Skills Kit

Code

Sample Code for Using SpeechconJavaScript
    'AMAZON.YesIntent': function() {
        console.log('Preparing to pitch');

        // gather current state of the game
        var inning      = this.attributes["inning"];
        var atBat       = this.attributes["visitorBatter"];
        var batterName  = visitorLineup[atBat-1].lastName
        var pitcherName = homeLineup[8].lastName;

        var audioOutput = pitcherName + " takes the mound in the top of the " + inning + "th inning. ";
            audioOutput = audioOutput + "<break time=\"1s\"/>";
            audioOutput = audioOutput + "Now batting is " + batterName + ". ";
            audioOutput = audioOutput + "<break time=\"1s\"/>";
            audioOutput = audioOutput + "<say-as interpret-as=\"interjection\">batter up</say-as>";
            audioOutput = audioOutput + "<break time=\"1s\"/>";
            audioOutput = audioOutput + "Select a pitch to throw to the batter. ";

        var repromptOutput = "Try saying Fastball, Curve, Slider, or Change-up.";

        // reset the bases
        this.attributes["balls"]   = 0;
        this.attributes["strikes"] = 0;
        this.attributes["runnerOnFirst"]  = false;
        this.attributes["runnerOnSecond"] = false;
        this.attributes["runnerOnThird"]  = false;

        VoiceInsights.track('firstPitch', null, 'middleFastball', (error, response) => {
            this.emit(':ask', audioOutput, repromptOutput);
        });
    },

Credits

Ae3c1c83656a52dbb51f05ebd67a95c4
Terren Peterson

Life-long learner who started off with an Electrical Engineering degree, but have been in software and systems engineering my whole career.

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

WiFi Strength Meter
Easy
  • 499
  • 6

A meter that indicates the Wi-Fi signal strength in an intuitive way, using the parts I had on hand.

Cryptocurrency Price Checker!
Easy
  • 171
  • 2

Full instructions

With the recent rise in cryptocurrencies, this Price Checker will keep you up to date with the most recent market fluctuations!

Trademark Master
Easy
  • 325
  • 10

Work in progress

Trademark Master tells you if any string has already been registered.

Opening Bell
Easy
  • 1,555
  • 23

Full instructions

A simple Alexa voice skill to retrieve the current performance of a publicly traded stock (NASDAQ, NYSE) using the company name.

Brick Bot
Easy
  • 706
  • 14

Protip

A one-stop-skill for your LEGO® needs! Alexa can tell you available sets, themes, and sub-themes and give you details based on set numbers.

Funny Quoter
Easy
  • 328
  • 8

Full instructions

This has some of the weirdest quotes up her sleeve! If you're feeling blue, and need something to cheer you up, just call on Funny Quoter.

Add projectSign up / Login