Sending text to Photon

How do I go about sending plain text to photon that will be passed to a Parallax Emic 2 Text to Speech Module thence to a small loudspeaker in a Teddy Ruxpin bear.
This will be similar to the project in Make magazine that uses the not yet available CHIP board.
My intent is to type text in a laptop or cell phone connected to the cloud.
Dave

Reading the docs never hurts… https://docs.particle.io/reference/firmware/photon/#particle-function-

Thank you Moors. Yours is good advice.
For this old guy with a weak brain, this will take some time.
A few suggestions for me to research would help.
Dave

There’s a neat tutorial in functions over here that has helped me in the past: Tutorial: Spark Variable and Function on One Web Page

Here’s a small demo:

void setup() {
    Serial.begin(9600);
    Particle.function("passText", handleText);
}

void loop() {

}

//Normally you should keep this as short as possible.
//For simplicities sake, I've put it in the function handler.
//in real-life, but it in the loop, and only set a 'flag' here.
int handleText(String actualText){
    RGB.control(true);
    RGB.color(0,255,0);
    Serial.println(actualText);
    Particle.publish("eventNameHere", actualText);
    delay(1000);
    RGB.control(false);
    
    return 0;
}

Put that on your device. Then, log in over here. You should see your devices, their variables and functions. Click on the blue button on the bottom, and keep both pages open. Then, on the first page, enter something in the “passText” function, and click send. You should then see that pop up in the second screen :smile:

1 Like