This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
misty.MoveHeadDegrees(0, 0, 0, 30); | |
_subscribeToBackpackData(); | |
function _subscribeToBackpackData() | |
{ | |
misty.ChangeLED(0, 0, 255); | |
misty.DisplayImage("e_DefaultContent.jpg"); | |
misty.AddReturnProperty("backpackMessage", "SerialMessage"); | |
misty.RegisterEvent("backpackMessage", "SerialMessage", 50, false); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
polly = boto3.client('polly') | |
response = polly.synthesize_speech(OutputFormat='mp3',Text = text,VoiceId = "Salli") | |
if "AudioStream" in response: | |
with closing(response["AudioStream"]) as stream: | |
audio = base64.encodebytes(stream.read()) | |
out = str(audio.decode("ascii")).replace('\n', '') | |
logger.info(out) | |
logger.info(len(out)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
else if (data.type == 'say') | |
{ | |
var base64 = data.say; | |
var next = data.next; | |
misty.Debug(next); | |
misty.Debug(typeof next); | |
if (next == "None") | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
misty.RegisterTimerEvent("keepActive", 18000, true); | |
function _keepActive() { | |
misty.SendExternalRequest("POST", "https://ps.pndsn.com/publish/<publish-key>/<subscribe-key>/0/<pubnub-channel>/myCallback", null, null, "{}", false, false, "", "application/json"); | |
} | |
misty.SendExternalRequest("GET", "https://ps.pndsn.com/subscribe/<subscribe-key>/<pubnub-channel>/0/0?uuid=<any-user-name>", null, null, "{}", false, false, "", "application/json", "_pubNubSubscribe"); | |
function _pubNubSubscribe(data) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"actions": [ | |
{ | |
"redirect": "https://<twilio-function-endpoint>.twil.io/say" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.handler = function(context, event, callback) { | |
var parameter = event.CurrentInput.substr(event.CurrentInput.indexOf(" ") + 1); | |
console.log(parameter); | |
const replySms = parameter != 'You are amazing !' ? {"actions": [{"say": "[••] Speaking "+parameter+"!"}]} : {"actions": [{"say": "[••] Sorry i did't understand, What should i say again"}]} | |
const replyErrorSms = {"actions": [{"say": "[••] Oops an error occured, Could you please try again.."}]}; | |
const axios = require('axios') |