Back to Parent

void setup() {

  Particle.function("happy",setHappy); 
  Particle.function("sad",setSad); 
  Particle.function("fear",setFear); 
  Particle.function("disgust",setDisgust); 
  Particle.function("anger",setAnger); 
  Particle.function("surprise",setSurprise); 
  Particle.function("off",setOff); 
  
  Particle.publish("emotion", "off", PRIVATE);

}

int setHappy(String command){
    if(command.equals("happy")){
        Particle.publish("emotion", "happy", PRIVATE);
        return 1;
    }
}


int setSad(String command){
    if(command.equals("sad")){
        Particle.publish("emotion", "sad", PRIVATE);
        return 2;
    }
}

int setFear(String command){
    if(command.equals("fear")){
        Particle.publish("emotion", "fear", PRIVATE);
        return 3;
    }
}

int setDisgust(String command){
    if(command.equals("disgust")){
        Particle.publish("emotion", "disgust", PRIVATE);
        return 4;
    }
}

int setAnger(String command){
    if(command.equals("anger")){
        Particle.publish("emotion", "anger", PRIVATE);
        return 5;
    }
}

int setSurprise(String command){
    if(command.equals("surprise")){
        Particle.publish("emotion", "surprise", PRIVATE);
        return 6;
    }
}

int setOff(String command){
    if(command.equals("off")){
        Particle.publish("emotion", "off", PRIVATE);
        return 0;
    }
}


void loop(){
    
}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0