Luis Eduardo Arenas Deseano
Published © Apache-2.0

The Robot MARKUS for Your Business

It's a low-cost and handmade robot with the mission to be attractive to the clients from businesses and help with the rate of services.

AdvancedFull instructions provided15 days3,674
The Robot MARKUS for Your Business

Things used in this project

Hardware components

MDF
×3
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×2
Arduino UNO
Arduino UNO
×1
Arduino Mega 2560
Arduino Mega 2560
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
ESP8266 ESP-01
Espressif ESP8266 ESP-01
×1
DFPlayer mini
×1
5 mm LED: Red
5 mm LED: Red
×10
General Purpose Transistor NPN
General Purpose Transistor NPN
×1
Display LCD 20x4 with I2C module
×1
MG995 Metal Gear High Speed Torque Servo
×1

Software apps and online services

Arduino IDE
Arduino IDE
Ubidots
Ubidots
SORACOM Air IoT Connectivity Platform
SORACOM Air IoT Connectivity Platform

Hand tools and fabrication machines

Drill, Screwdriver
Drill, Screwdriver
Hot glue gun (generic)
Hot glue gun (generic)
Hammer
Extraction Tool, 6 Piece Screw Extractor & Screwdriver Set
Extraction Tool, 6 Piece Screw Extractor & Screwdriver Set

Story

Read more

Custom parts and enclosures

The robot

This is a model scaled of all the parts from the robot (it was made in CATIA)

Schematics

General schematic

This is the general schematic witll all the connections (sensors, buttons and communications)

Code

CODE FOR THE ARDUINO MEGA

Arduino
this is the code only for the arduino mega
/*DEVELOPER: LUIS EDUARDO ARENAS DESEANO
 * PUEBLA MEXICO
 * ALL RIGHTS RESERVED BY ROBOT MARKUS
 * WATCHDOG COMPANY
 */

#define SSID "Wicho"     // "SSID-WiFiname write here the name of you wifi connection" 
#define PASS "xnam9730"       // "password wirter here the password of your wifi modem

#define IP "translate.ubidots.com"// ubidots ip
String msgr = "markus/1.0|LV|";    //message to receive info
String msge = "markus/1.0|POST|";  //message to send info
String key="BBFF-lsw5wdRVxKN6tyfXuz0aun6RBvecrP";  //Default token of th ubidost account
String Device1="markus";      //device's name
String Variable1="pregunta1";     //variable's name of ubidots
String Variable2="pregunta11"; //variable's name of ubisots
String Variable3="pregunta2"; //variable's name of ubisots
String Variable4="pregunta22"; //variable's name of ubisots
String Variable5="servicio"; //variable's name of ubisots


#include <LiquidCrystal_I2C.h> // library to configure the I2C display 
LiquidCrystal_I2C lcd(0x27,20,4); // I2C adress for the I2C display

 #include <SoftwareSerial.h> // library toi declare a new serial port in the arduino
SoftwareSerial bluetooth(12,13); // name of the new port declared and with the pins

#include <Wire.h> //library to use the SDA and SCL port of the arduino (I2C connection)

#include <CapacitiveSensor.h> // library to configure two ports as capacitive sensor
 
CapacitiveSensor   sensor = CapacitiveSensor(4,3); // the name "sensor" correspon to the port of the capacitive sensor

 long lectura=0; // to read the capacitive sensor

#include <SoftwareSerial.h> // library to define a new serial port
#include <DFMiniMp3.h> // library to manipulate and configure the MP3 module
class Mp3Notify // a class to configure the mp3 module
{
public:
  static void OnError(uint16_t errorCode) // libraries neccesaries for the mp3 module just copy it
  {
    // see DfMp3_Error for code meaning
    Serial.println();
    Serial.print("Com Error ");
    Serial.println(errorCode);
  }

  static void OnPlayFinished(uint16_t globalTrack) // libraries neccesaries for the mp3 module just copy it
  {
    Serial.println();
    Serial.print("Play finished for #");
    Serial.println(globalTrack);   
  }

  static void OnCardOnline(uint16_t code) // libraries neccesaries for the mp3 module just copy it
  {
    Serial.println();
    Serial.print("Card online ");
    Serial.println(code);     
  }

  static void OnCardInserted(uint16_t code) // libraries neccesaries for the mp3 module just copy it
  {
    Serial.println();
    Serial.print("Card inserted ");
    Serial.println(code); 
  }

  static void OnCardRemoved(uint16_t code)// libraries neccesaries for the mp3 module just copy it
  {
    Serial.println();
    Serial.print("Card removed ");
    Serial.println(code);  
  }
};

DFMiniMp3<HardwareSerial, Mp3Notify> mp3(Serial1); // THIS IS AN IMPORTANT LINE; THIS IS TO ASSING THE SERIAL PORT TO THE MP3 MODULE


String mensaje;

int boton_verde=10; // variable to define the digital port for the green button
int boton_rojo=11; // variable to define the digital port for the red button
int corazon=2; // variable to define the digital port for the led of the heart

int valor_rojo=0; // variable to keep the data from the red button
int valor_verde=0; // variable to keep the data from the green button

int ban1=0; // flag variable to notice the change
int ban2=0; // flag variable to notice the change

int servicio1=0; // variable to know when there is a bad service
//int servicio2=0; 
//int servicio3=0;

int resp1=0; // variable to keep the value of the answer for the question number 1
int resp2=0; // variable to keep the value of the answer for the question number 2
// you can enter as much questions as you want 
//int resp3=0;
//int resp4=0;
//int resp5=0;

#define Pecho 6 // define the digital port for the echo pin of the ultrasonic sensor
#define Ptrig 7 // define the digital port for the trig pin of the ultrasonic sensor
#define Pecho2 8 // define the digital port for the echo pin of the ultrasonic sensor
#define Ptrig2 9 // define the digital port for the trig pin of the ultrasonic sensor
long duracion, distancia;  // variables to read the duration and the distance of the sensor
long duracion2, distancia2; // variables to read the duration and the distance of the sensor   


int tempo=0; // variable to measure the time passed to back to the original position
int activado=0; // variable that detect when the electronic timer is active

void setup() {
  Serial.begin(9600); // inicialize the firts serial to read the serial monitor in the conputer
  Serial2.begin(9600); // inicialize the serial port number two from the arduino mega
  bluetooth.begin(9600); // inicialize the serial port for the bluetooth

  
  lcd.init(); //inicialize the display LCD for the I2C comunication
  lcd.clear(); // clean the display

  pinMode(24,INPUT); //define the input port for the electronic timmer
  pinMode(22,OUTPUT); // define the output port for the electronic timmer
  digitalWrite(22,HIGH); // we activate it for the first time
  
  
    Wire.begin(); // iniciate the I2c port
  mp3.begin(); //iniciate the mp3 module
    mp3.setVolume(25); // set the volume to the 25 percent ( RECOMANDED IN 50%)
   mp3.playMp3FolderTrack(1);    // reproduce a track

   delay(2000);
     Wire.beginTransmission(8); // transmit to device #8 
   Wire.write(1); //send a 1 to the device 8
   Wire.endTransmission(); // en the transmission
   
   delay(6000);
   
   lcd.backlight(); // make a blink in the display
  lcd.clear(); // clear the display
  lcd.setCursor(4,0); // set the cursor
  lcd.print("  H O L A !"); // show a message of welcome
    lcd.setCursor(4,1);
  lcd.print("SOY  MARKUS"); // show a message of welcome
    lcd.setCursor(0,3);
  lcd.print("ESTOY PARA SERVIRTE!"); // show a message of welcome
   delay(3000);
   digitalWrite(corazon,1); // make he heart blink, just one time
   delay(1000);
   digitalWrite(corazon,0); // make he heart blink, just one time

pinMode(Pecho, INPUT);     // define the connection for ultrasonic sensors
  pinMode(Ptrig, OUTPUT);    
  pinMode(Pecho2, INPUT);    
  pinMode(Ptrig2, OUTPUT);

  
pinMode(boton_rojo,INPUT); //define the buttons
pinMode(boton_verde,INPUT);
pinMode(corazon,OUTPUT);  // define the led of the heart

Serial.println("AT");
  Serial2.println("AT");  
 String cmd="AT+CWJAP=\"";           //this command allow us to connect our module to the wifi
  cmd+=SSID;                          //
  cmd+="\",\"";
  cmd+=PASS;
  cmd+="\"";
  Serial.println(cmd);                //send and string with the instructions for connections
  Serial2.println(cmd);
delay(3000);
Serial.println("listo");
 if(Serial2.find("OK")){ //if it find and OK, it will answer yes
    connectWiFi();        //connect the wifi
  }

digitalWrite(corazon,1); 
}
  
  void connectWiFi(){   //this part is to connect the wifi
  Serial.println("AT+CWMODE=1");      
  Serial2.println("AT+CWMODE=1");
 // delay(1000);                        
  String cmd="AT+CWJAP=\"";           
  cmd+=SSID;                          
  cmd+="\",\"";
  cmd+=PASS;
  cmd+="\"";
  Serial.println(cmd);               
  Serial2.println(cmd);
  //delay(1000);
  if(Serial2.find("OK")){
    Serial.println("OK"); //
   }
}

void enviomensaje(String device, String variable, int data){ // in this parti we define the method to send a message to  UBIDOTS
  String cmd = "AT+CIPSTART=\"TCP\",\"";     //Preparamos cadena con Inicio de comunicacin
  cmd += IP;
  cmd += "\",9012";
  
  Serial.println(cmd);
  Serial2.println(cmd);               //Enviamos comando  de Inicio de comunicacin
  //delay(1000);
  if(Serial2.find("Error")){          //Si leemos error en la comunicacin terminamos
    return;
  }

  cmd = msge ;             //Preparamos cadena con mensaje de GET
  cmd += key;      //Agregamos key
  cmd +="|";
  cmd += device;  //Agregamos Dispositivo 
  cmd +="=>";
  cmd += variable;  //Agregamos variable
  cmd +=":";
  cmd += data;    //Agregamos el dato a enviar
  cmd +="|end";
  cmd += "\r\n";
  Serial.print("AT+CIPSEND=");    //Enviamos comando de Envio
  Serial2.print("AT+CIPSEND=");
  Serial.println(cmd.length());   //Enviamos longitud de mensaje y enter
  Serial2.println(cmd.length());
  if(Serial2.find(">")){          //Esperamos a recibir orden de envio de mensaje
    Serial.print(cmd);
    Serial2.print(cmd);           //Enviamos mensaje
  }

  //delay(1000);
}
void latir() // method to maje the heart blink
{
  delay(7000);
  for(int i=0;i<=9;i++){
    digitalWrite(corazon,1);
    delay(800);
    digitalWrite(corazon,0);
    delay(800);
  }
}


void loop() {

 digitalWrite(Ptrig, LOW);
  delayMicroseconds(2);
  digitalWrite(Ptrig, HIGH);   // generate a pulse in the trigger by 10ms
  delayMicroseconds(10);
  digitalWrite(Ptrig, LOW);
  
  duracion = pulseIn(Pecho, HIGH);
  distancia = (duracion/2) / 29;            // calculate the distance in centimeters

  digitalWrite(Ptrig2, LOW);
  delayMicroseconds(2);
  digitalWrite(Ptrig2, HIGH);   //generate a pulse in the trigger by 10ms
  delayMicroseconds(10);
  digitalWrite(Ptrig2, LOW);
  
  duracion2 = pulseIn(Pecho2, HIGH);
  distancia2 = (duracion2/2) / 29;    

  Serial.print(distancia);
  Serial.print(" ");
  Serial.println(distancia2);

  while(bluetooth.available()){//make sure thajt the conenction is available 
    delay(10);
    char c = bluetooth.read();//keep the lecture of the buff
    mensaje += c; //concatenating the context
  }

if(mensaje.length()>0){//verify taht the variable is empty

  // FROM THIS PART HERE IS ALL THE COMMAND PER VOICE FOR THE ANDROID APP OF THE ROBOT 
  
    if(mensaje=="*saludar"){
       Wire.beginTransmission(8); // transmit to device #8
   Wire.write(3);
   Wire.endTransmission();
   mp3.playMp3FolderTrack(3);
     }//interpretando mensaje
    else if (mensaje=="*despedir"){
      Wire.beginTransmission(8); // transmit to device #8
   Wire.write(4);
   Wire.endTransmission();
   mp3.playMp3FolderTrack(10);
   latir();
    }//y ejecutando instrucciones
    else if (mensaje=="*baila"){
    mp3.playMp3FolderTrack(11);
   delay(2000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(6);
   Wire.endTransmission();
   delay(7000);
   }//y ejecutando instrucciones
      else if (mensaje=="*chiste"){
    int randomchiste=random(42,44);
    mp3.playMp3FolderTrack(randomchiste);
   delay(2000);
   // Wire.beginTransmission(); // transmit to device #8
   //Wire.write(6);
   //Wire.endTransmission();
   }//y ejecutando instrucciones
         else if (mensaje=="*cantar"){
    //long tiempo;
    //int randomcanto=random(12,13);
    mp3.playMp3FolderTrack(13);
    //if(randomcanto==12){
    //  tiempo=9000;
   // }else{
    //  tiempo=14000;
    //}
   delay(14000);
   Wire.beginTransmission(8); // transmit to device #8
   Wire.write(9);
   Wire.endTransmission();
   }//y ejecutando instrucciones
            else if (mensaje=="*bailemos"){
    mp3.playMp3FolderTrack(14);
   delay(8000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(8);
   Wire.endTransmission();
   }//y ejecutando instrucciones
            else if (mensaje=="*Cantemos"){
    mp3.playMp3FolderTrack(15);
   delay(2000);
   // Wire.beginTransmission(); // transmit to device #8
   //Wire.write(6);
   //Wire.endTransmission();
   }//y ejecutando instrucciones
            else if (mensaje=="*foto"){
    mp3.playMp3FolderTrack(16);
   delay(6000);
   }//y ejecutando instrucciones
            else if (mensaje=="*agradecer foto"){
    mp3.playMp3FolderTrack(17);
   delay(2000);
  }//y ejecutando instrucciones
            else if (mensaje=="*celebrar"){
    mp3.playMp3FolderTrack(19);
   delay(6000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(10);
   Wire.endTransmission();
   for(int i=0;i<=8;i++){
  digitalWrite(corazon,0);
  delay(1000);
  digitalWrite(corazon,1);
  delay(1000);
    }
            }//y ejecutando instrucciones
                        else if (mensaje=="*rector"){
    mp3.playMp3FolderTrack(18);
   delay(6000);
    }
                            else if (mensaje=="*saludo mobility"){
    mp3.playMp3FolderTrack(20);
    delay(3000);
     Wire.beginTransmission(8); // transmit to device #8
   Wire.write(3);
   Wire.endTransmission();
   delay(6000);
    }
                            else if (mensaje=="*misin mobility"){
    mp3.playMp3FolderTrack(21);
   delay(6000);
    }
                            else if (mensaje=="*valores mobility"){
    mp3.playMp3FolderTrack(22);
   delay(6000);
    }
                            else if (mensaje=="*mobility global"){
    mp3.playMp3FolderTrack(23);
   delay(6000);
    }
                            else if (mensaje=="*Vctor"){
    mp3.playMp3FolderTrack(24);
   delay(3000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(5);
   Wire.endTransmission();
   delay(2000);
   do{
    lectura =  sensor.capacitiveSensor(30);
    if(lectura>5){
          Wire.beginTransmission(8); // transmit to device #8
   Wire.write(2);
   Wire.endTransmission();
   delay(2000);
    }
   }while(lectura<5);
   lectura=0;
    }
                            else if (mensaje=="*Guillermo"){
    mp3.playMp3FolderTrack(25);
   delay(6000);
    }
                            else if (mensaje=="*prensa"){
    mp3.playMp3FolderTrack(26);
   delay(6000);
    }
                            else if (mensaje=="*Uriarte"){
    mp3.playMp3FolderTrack(27);
   delay(6000);
    }
                            else if (mensaje=="*dulce"){
    mp3.playMp3FolderTrack(28);
   delay(6000);
    }
                            else if (mensaje=="*despedida mobility"){
    mp3.playMp3FolderTrack(39);
   delay(6000);
    }
                            else if (mensaje=="*frase"){
    mp3.playMp3FolderTrack(47);
   delay(6000);
    }
    
                            else if (mensaje=="*music"){
    int num=random(29,38);
    mp3.playMp3FolderTrack(num);
   delay(6000);
    }

                                else if (mensaje=="*Navidad"){
    int num=random(53,55);
    mp3.playMp3FolderTrack(num);
   delay(6000);
    }
                                    else if (mensaje=="*deseo mobility"){
   // int num=random(53,55);
    mp3.playMp3FolderTrack(56);
   delay(3000);
   Wire.beginTransmission(8); // transmit to device #8
   Wire.write(3);
   Wire.endTransmission();
   delay(6000);
    }
                                    else if (mensaje=="*Aldo"){
    //int num=random(53,55);
    mp3.playMp3FolderTrack(52);
   delay(4000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(5);
   Wire.endTransmission();
   delay(2000);
   do{
    lectura =  sensor.capacitiveSensor(30);
    if(lectura>5){
          Wire.beginTransmission(8); // transmit to device #8
   Wire.write(2);
   Wire.endTransmission();
   delay(2000);
    }
   }while(lectura<5);
   lectura=0;
    }
                                    else if (mensaje=="*Aurelio"){
    //int num=random(53,55);
    mp3.playMp3FolderTrack(48);
   delay(4000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(5);
   Wire.endTransmission();
   delay(2000);
   do{
    lectura =  sensor.capacitiveSensor(30);
    if(lectura>5){
          Wire.beginTransmission(8); // transmit to device #8
   Wire.write(2);
   Wire.endTransmission();
   delay(2000);
    }
   }while(lectura<5);
   lectura=0;
    }
                                    else if (mensaje=="*Too"){
    //int num=random(53,55);
    mp3.playMp3FolderTrack(49);
   delay(4000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(5);
   Wire.endTransmission();
   delay(2000);
   do{
    lectura =  sensor.capacitiveSensor(30);
    if(lectura>5){
          Wire.beginTransmission(8); // transmit to device #8
   Wire.write(2);
   Wire.endTransmission();
   delay(2000);
    }
   }while(lectura<5);
   lectura=0;
    }
                                    else if (mensaje=="*Dante"){
    //int num=random(53,55);
    mp3.playMp3FolderTrack(50);
   delay(4000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(5);
   Wire.endTransmission();
   delay(2000);
   do{
    lectura =  sensor.capacitiveSensor(30);
    if(lectura>5){
          Wire.beginTransmission(8); // transmit to device #8
   Wire.write(2);
   Wire.endTransmission();
   delay(2000);
    }
   }while(lectura<5);
   lectura=0;
    }
                                    else if (mensaje=="*Carlos"){
    //int num=random(53,55);
    mp3.playMp3FolderTrack(52);
   delay(4000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(5);
   Wire.endTransmission();
   delay(2000);
   do{
    lectura =  sensor.capacitiveSensor(30);
    if(lectura>5){
          Wire.beginTransmission(8); // transmit to device #8
   Wire.write(2);
   Wire.endTransmission();
   delay(2000);
    }
   }while(lectura<5);
   lectura=0;
    }
                                    else if (mensaje=="*Humberto"){
    //int num=random(53,55);
    mp3.playMp3FolderTrack(57);
   delay(4000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(5);
   Wire.endTransmission();
   delay(2000);
   do{
    lectura =  sensor.capacitiveSensor(30);
    if(lectura>5){
          Wire.beginTransmission(8); // transmit to device #8
   Wire.write(2);
   Wire.endTransmission();
   delay(2000);
    }
   }while(lectura<5);
   lectura=0;
    }
                                    else if (mensaje=="*Jaime"){
    //int num=random(53,55);
    mp3.playMp3FolderTrack(58);
   delay(4000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(5);
   Wire.endTransmission();
   delay(2000);
   do{
    lectura =  sensor.capacitiveSensor(30);
    if(lectura>5){
          Wire.beginTransmission(8); // transmit to device #8
   Wire.write(2);
   Wire.endTransmission();
   delay(2000);
    }
   }while(lectura<5);
   lectura=0;
    }
                                    else if (mensaje=="*Juan Carlos"){
    //int num=random(53,55);
    mp3.playMp3FolderTrack(60);
   delay(4000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(5);
   Wire.endTransmission();
   delay(2000);
   do{
    lectura =  sensor.capacitiveSensor(30);
    if(lectura>5){
          Wire.beginTransmission(8); // transmit to device #8
   Wire.write(2);
   Wire.endTransmission();
   delay(2000);
    }
   }while(lectura<5);
   lectura=0;
    }
                                    else if (mensaje=="*Javier"){
    //int num=random(53,55);
    mp3.playMp3FolderTrack(61);
   delay(4000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(5);
   Wire.endTransmission();
   delay(2000);
   do{
    lectura =  sensor.capacitiveSensor(30);
    if(lectura>5){
          Wire.beginTransmission(8); // transmit to device #8
   Wire.write(2);
   Wire.endTransmission();
   delay(2000);
    }
   }while(lectura<5);
   lectura=0;
    }
                                        else if (mensaje=="*Oracle"){
    //int num=random(53,55);
    mp3.playMp3FolderTrack(62);
   delay(4000);
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(5);
   Wire.endTransmission();
   delay(2000);
   do{
    lectura =  sensor.capacitiveSensor(30);
    if(lectura>5){
          Wire.beginTransmission(8); // transmit to device #8
   Wire.write(2);
   Wire.endTransmission();
   delay(2000);
    }
   }while(lectura<5);
   lectura=0;
    }
                             else if (mensaje=="*info Oracle"){
    mp3.playMp3FolderTrack(63);
   delay(6000);
    }
                             else if (mensaje=="*rayo"){
    mp3.playMp3FolderTrack(64);
   delay(6000);
    }
                             else if (mensaje=="*presenta watchdog"){
    mp3.playMp3FolderTrack(65);
   delay(6000);
    }
                                else if (mensaje=="*Cul es la base de datos ms importante del mundo" || mensaje=="*Cul es la base de datos ms importantes del mundo"){
    mp3.playMp3FolderTrack(66);
   delay(6000);
    }
    
  
    else if (mensaje=="*inicio"){
    mp3.stop();
    Wire.beginTransmission(8); // transmit to device #8
   Wire.write(7);
   Wire.endTransmission();
   }//y ejecutando instrucciones
  
  }

  mensaje="";//reseteando variable 


if(ban1==0){
 if ((distancia <= 20 && distancia >= 1) || (distancia2 <= 20 && distancia2 >= 1)){ // read and compare the distance of the sensor here is difne to 20 centimeters or less
  ban1=1;
 }
}

if(ban1==1){
  if(ban2==0){
  mp3.playMp3FolderTrack(2);  // reproduce an audio whre the robot presentate itself
  ban2=1;
 // enviomensaje(Device1,Variable2,0);
  delay(6000);
  }
   Wire.beginTransmission(8); // transmit to device #8 to wave out
   Wire.write(5);
   Wire.endTransmission();
   
    digitalWrite(22,LOW); //activate the electronic timmer
    digitalWrite(22,HIGH); //desactivate the electornic timmer
    //activado=1;
   
   do{
//    lectura =  sensor.capacitiveSensor(30);
//  Serial.println(lectura);
   activado=digitalRead(24);
   lectura =  sensor.capacitiveSensor(30); // read the lecture from the capacitibe sensor 
      Serial.println(lectura);
      Serial.println("en el timer");
  if(lectura > 50) // if the lecture if more than 50 its that we touch it
   {
    mp3.playMp3FolderTrack(4); // reproduce an audio that explain the routine of the QnA
    delay(5000);
     Wire.beginTransmission(8); // transmit to device #8
      Wire.write(2);
      Wire.endTransmission();
      ban1=2;
      ban2=0;
      activado=0;
      delay(8000);
      //activado=1;
    }

         delay(10);    
   }while(activado==1); 

    if(activado==0 && lectura < 5){
      ban1=0;
      ban2=0;
      Wire.beginTransmission(8); // transmit to device #8 down the arm
      Wire.write(2);
      Wire.endTransmission();
      
    }

}
else if(ban1==2){ // firts quiestion
  mp3.playMp3FolderTrack(5);
  lcd.clear(); // clear the display
  lcd.clear();
    lcd.setCursor(2,1);   // we show the question on the display
  lcd.print("TE GUSTARON LAS");
  lcd.setCursor(3,2);
  lcd.print("SOLUCIONES QUE");
   lcd.setCursor(4,3);
  lcd.print("OFRECE EBIW");
  delay(4000);
    //digitalWrite(22,LOW); //CON LOW SE ACTIVA
    //digitalWrite(22,HIGH); // CON HIGH SE DESACTIVA
  do{  // we wait for the activation of one of the buttons
    //activado=digitalRead(24);
    valor_rojo=digitalRead(boton_rojo);  // read the value of the red button
    valor_verde=digitalRead(boton_verde); // read the value of the green button
    if(valor_rojo==1 && valor_verde==0){ // if the red button is pressed we upgrade the variable for the answer and move to the next question
      resp1=2;
      ban1=3;

    }
    else if(valor_rojo==0 && valor_verde==1){// if the green button is pressed we upgrade the variable for the answer and move to the next question
      resp1=1;
    
       ban1=3;
   
    }
  }while(resp1==0);
   
    
   if(resp1==1)
   enviomensaje(Device1,Variable1,1); //we send the answer to the cloud data base
  else if(resp1==2){
  enviomensaje(Device1,Variable2,1);
  //enviomensaje(Device1,Variable9,1);
  }
  valor_rojo=0; //reset of the variables
  valor_verde=0;
  resp1=0;
  
}

else if(ban1==3){  // second question
  mp3.playMp3FolderTrack(6);
  lcd.clear(); //clear the display
    lcd.setCursor(2,0);   // show the question on the display
  lcd.print("RECOMENDARIAS EL");
  lcd.setCursor(3,1);
  lcd.print("PORTAFOLIO DE");
   lcd.setCursor(1,2);
  lcd.print("SOLUCIONES DE EBIW");
  delay(4000);
  //digitalWrite(22,LOW); //CON LOW SE ACTIVA
  //digitalWrite(22,HIGH); // CON HIGH SE DESACTIVA

  
  do{
    //activado=digitalRead(24);
    valor_rojo=digitalRead(boton_rojo);  // read the values of the buttons
    valor_verde=digitalRead(boton_verde);
    if(valor_rojo==1 && valor_verde==0){  // update the answers an move to the thanks message
      resp2=2;
//      servicio2=1;
      ban1=4;
      //activado=0;
    }
    else if(valor_rojo==0 && valor_verde==1){
      resp2=1;
//      servicio2=0;
      ban1=4;
      //activado=0;
    }
  }while(resp2==0);
  ban1=7;
 
 if(resp2==1)
   enviomensaje(Device1,Variable3,1);
  else if(resp2==2)
  enviomensaje(Device1,Variable4,1);
  valor_rojo=0;
  valor_verde=0;
  resp2=0;
}
/*
else if(ban1==4){
  mp3.playMp3FolderTrack(7);
  lcd.clear();
    lcd.setCursor(2,0);
  lcd.print("TE GUSTARIA QUE");
  lcd.setCursor(2,1);
  lcd.print("UN ROBOT APLIQUE");
   lcd.setCursor(2,2);
  lcd.print("ENCUESTAS EN TU");
   lcd.setCursor(6,3);
  lcd.print("EMPRESA");
  delay(4000);
  do{
    valor_rojo=digitalRead(boton_rojo);
    valor_verde=digitalRead(boton_verde);
    if(valor_rojo==1 && valor_verde==0){
      resp3=2;
      servicio1=1; //////////////////////////// quitar comando
    }
    else if(valor_rojo==0 && valor_verde==1){
      resp3=1;
      servicio1=0; //////////////////////////// quitar comando 
    }
  }while(resp3==0);
  ban1=7; ///////////////////////////////////////////////////// REGRESAR A 5
     if(resp3==1)
   enviomensaje(Device1,Variable5,1);
  else if(resp3==2)
  enviomensaje(Device1,Variable6,1);
  valor_rojo=0;
  valor_verde=0;
  resp3=0;
}

else if(ban1==5){
  mp3.playMp3FolderTrack(8);
  lcd.clear();
    lcd.setCursor(4,0);
  lcd.print("RECOMENDARIAS");
  lcd.setCursor(7,1);
  lcd.print("NUESTRO");
   lcd.setCursor(6,2);
  lcd.print("SERVICIO");
  delay(4000);
  do{
    valor_rojo=digitalRead(boton_rojo);
    valor_verde=digitalRead(boton_verde);
    if(valor_rojo==1 && valor_verde==0){
      resp4=2;
    }
    else if(valor_rojo==0 && valor_verde==1){
      resp4=1;
    }
  }while(resp4==0);
  ban1=6;
     if(resp4==1)
   enviomensaje(Device1,Variable7,1);
  else if(resp4==2)
  enviomensaje(Device1,Variable8,1);
  valor_rojo=0;
  valor_verde=0;
  resp4=0;
}

else if(ban1==6){
  mp3.playMp3FolderTrack(59);
  lcd.clear();
  lcd.setCursor(2,0);
  lcd.print("CONSIDERAS BUENA");
  lcd.setCursor(4,1);
  lcd.print("EL SERVICIO");
   lcd.setCursor(3,2);
  lcd.print("DE CAFETERIA");
   lcd.setCursor(4,3);
  lcd.print("EN LA SALA");
  
  delay(4000);
  do{
    valor_rojo=digitalRead(boton_rojo);
    valor_verde=digitalRead(boton_verde);
    if(valor_rojo==1 && valor_verde==0){
      resp5=2;
    }
    else if(valor_rojo==0 && valor_verde==1){
      resp5=1;
    }
  }while(resp5==0);
  ban1=7;
     if(resp5==1)
   enviomensaje(Device1,Variable10,1);
  else if(resp5==2)
  enviomensaje(Device1,Variable11,1);
  valor_rojo=0;
  valor_verde=0;
  resp5=0;
}
*/
else if(ban1==7){
  if(servicio1==1){ // if there is a bad service we would show an apologize message on the display
    lcd.clear();  
  lcd.setCursor(4,0);
  lcd.print("DISCULPE LAS"); // Mensaje a despegar
    lcd.setCursor(5,1);
  lcd.print("MOLESTIAS"); // Mensaje a despegar
     lcd.setCursor(5,2);
  lcd.print("PRONTO LO"); // Mensaje a despegar
     lcd.setCursor(5,3);
  lcd.print("ATENDERAN"); // Mensaje a despegar
  mp3.playMp3FolderTrack(40); // reproduce an apologize message he star to call person from the companien to assist the client
  enviomensaje(Device1,Variable5,1); // we update it to the cloud data base
  servicio1=0;
//  servicio2=0;
      Wire.beginTransmission(8); // transmit to device #8 to up the arm and to block the robot 
   Wire.write(5);
   Wire.endTransmission();
   delay(2000);
   do{
    lectura =  sensor.capacitiveSensor(30); // the robot is blocked here and waiting for the personal to unblocked it
    if(lectura>5){
      mp3.playMp3FolderTrack(41); // reproduce a message to apologize to the cliente and to hope to see hiim again
          Wire.beginTransmission(8); // transmit to device #8 dowm the arm
   Wire.write(2);
   Wire.endTransmission();
   enviomensaje(Device1,Variable5,0);
   delay(2000);
    }
   }while(lectura<5);
   lectura=0;

  }
  else{  // if there is a good service
  
  mp3.playMp3FolderTrack(9); // reproduce a message to grattitude the client for interactuate with him
  lcd.clear();
  lcd.setCursor(5,0);
  lcd.print("AGRADEZCO"); // show a gratitude message on the display
    lcd.setCursor(8,1);
  lcd.print("TU"); // Mensaje a despegar
    lcd.setCursor(3,2);
  lcd.print("PARTICIPACION"); // Mensaje a despegar
  
if(servicio1==1){  //update the quality of the service in the data base
  enviomensaje(Device1,Variable5,1);
  servicio1=0;
//  servicio2=0;
}else{
  enviomensaje(Device1,Variable5,0);
  servicio1=0;
 // servicio2=0;
}

 for(int i=0;i<=8;i++){ //make the heart blinking
  digitalWrite(corazon,0);
  delay(1000);
  digitalWrite(corazon,1);
  delay(1000);
 }

  }

  
  ban1=0;
  ban2=0;
  lcd.clear();  //clear the display and back to the welcome message
  lcd.setCursor(4,0);
  lcd.print("  H O L A !"); // Mensaje a despegar 
    lcd.setCursor(4,1);
  lcd.print("SOY  MARKUS"); // Mensaje a despegar
    lcd.setCursor(0,3);
  lcd.print("ESTOY PARA SERVIRTE!"); // Mensaje a despegar
}


 
 // delay(100);
}

CODE FOR THE ARDUINO UNO

Arduino
this is the code only for the arduino uno
/*DEVELOPER: LUIS EDUARDO ARENAS DESEANO
 * PUEBLA MEXICO
 * ALL RIGHTS RESERVED BY ROBOT MARKUS
 * WATCHDOG COMPANY
 */

/*
 * LEFT ARM DOWN POSITION 150   UP POSITION    80
 * RIGHT ARM DOWN POSITION 35   UP POSITION    120
 * BODY CENTER POSITION 90   LEFT POSITION    120 RIGHT POSITION 80
 */
 

#include <Servo.h>
Servo cuerpo,brazo_i,brazo_d;
long num;
int varcuerpo=90; 
int varbrazo_i=160;
int varbrazo_d=30;
int limcuerpoder=60;
int limcuerpoizq=130;
int limbrazo_i_arriba=70;
int limbrazo_i_abajo=160;
int limbrazo_d_arriba=140;
int limbrazo_d_abajo=30;
int x;
int velocidad=1;


#include <Wire.h>

void setup() {
  cuerpo.attach(3); // SERVO 1
  brazo_i.attach(5); // SERVO 2 
  brazo_d.attach(6); // SERVO 3

  cuerpo.write(90);
  brazo_d.write(30);
  brazo_i.write(160);
    Wire.begin(8);                // join i2c bus with address #8
  Wire.onReceive(receiveEvent); // register event
  Serial.begin(9600);           // start serial for output
}

void loop() {
  delay(100);
  switch(x){
    case 1:
      girarizquierda();
      girarderecha();
      centro();
      x=0;
      break;
    case 2:
      regresarcincoderecha();
      x=0;
      break;
     case 3:
      saludar();
      x=0;
      break;
     case 4:
      despedir();
      x=0;
      break;
     case 5:
      cincoderecha();
      x=0;
      break; 
      case 6:
      baile();
      x=0;
      break;
      case 7:
      cuerpo.write(90);
      brazo_d.write(30);
      brazo_i.write(160);
      x=0;
      break;
      case 8:
      bailemos();
      x=0;
      break;
      case 9:
      canta();
      x=0;
      break;
      case 10:
      celebrar();
      x=0;
      break;
      
      }

}

void girarizquierda()
{
  for(varcuerpo;varcuerpo<=limcuerpoizq;varcuerpo+=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
}
void girarderecha()
{
    for(varcuerpo;varcuerpo>=limcuerpoder;varcuerpo-=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
}
void centro()
{
    if(varcuerpo>102){
    for(varcuerpo;varcuerpo>=90;varcuerpo-=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }  
    }
    else{
      for(varcuerpo;varcuerpo<=90;varcuerpo+=1)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }  
    }
}
void cinco()
{
    for(varbrazo_i;varbrazo_i>=limbrazo_i_arriba;varbrazo_i-=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }

}
void cincoderecha()
{
    for(varbrazo_d;varbrazo_d<=limbrazo_d_arriba;varbrazo_d+=velocidad)
  {
    Serial.println(varbrazo_d);
    brazo_d.write(varbrazo_d);
    delay(15);
  }

}
void regresarcinco(){
        for(varbrazo_i;varbrazo_i<=limbrazo_i_abajo;varbrazo_i+=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
}
void regresarcincoderecha(){
        for(varbrazo_d;varbrazo_d>=limbrazo_d_abajo;varbrazo_d-=velocidad)
  {
    Serial.println(varbrazo_d);
    brazo_d.write(varbrazo_d);
    delay(15);
  }
}
void saludar(){
    for(varbrazo_i;varbrazo_i>=30;varbrazo_i-=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
          for(varbrazo_i;varbrazo_i<=80;varbrazo_i+=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
      for(varbrazo_i;varbrazo_i>=30;varbrazo_i-=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
            for(varbrazo_i;varbrazo_i<=80;varbrazo_i+=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
        for(varbrazo_i;varbrazo_i>=30;varbrazo_i-=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
        for(varbrazo_i;varbrazo_i<=limbrazo_i_abajo;varbrazo_i+=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
}
void despedir(){
      for(varbrazo_i;varbrazo_i>=30;varbrazo_i-=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
        for(varbrazo_d;varbrazo_d<=170;varbrazo_d+=velocidad)
  {
    Serial.println(varbrazo_d);
    brazo_d.write(varbrazo_d);
    delay(15);
  }
  girarderecha();
  girarizquierda();
  girarderecha();
  girarizquierda();
  girarderecha();
  girarizquierda();
  girarderecha();
  girarizquierda();
  girarderecha();
  girarizquierda();
    girarderecha();
  girarizquierda();
  centro();
  delay(6000);
        for(varbrazo_i;varbrazo_i<=limbrazo_i_abajo;varbrazo_i+=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
        for(varbrazo_d;varbrazo_d>=limbrazo_d_abajo;varbrazo_d-=velocidad)
  {
    Serial.println(varbrazo_d);
    brazo_d.write(varbrazo_d);
    delay(15);
  }
}
void baile(){
  centro();
  girarizquierda();
      for(varcuerpo;varcuerpo>=100;varcuerpo-=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarizquierda();
  girarderecha();
    for(varcuerpo;varcuerpo<=80;varcuerpo+=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarderecha();
    girarizquierda();
      for(varcuerpo;varcuerpo>=100;varcuerpo-=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarizquierda();
  girarderecha();
    for(varcuerpo;varcuerpo<=80;varcuerpo+=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarderecha();
    girarizquierda();
      for(varcuerpo;varcuerpo>=100;varcuerpo-=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarizquierda();
  girarderecha();
    for(varcuerpo;varcuerpo<=80;varcuerpo+=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarderecha();
    girarizquierda();
      for(varcuerpo;varcuerpo>=100;varcuerpo-=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarizquierda();
  girarderecha();
    for(varcuerpo;varcuerpo<=80;varcuerpo+=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarderecha();
  cinco();
  cincoderecha();
          for(varbrazo_d;varbrazo_d>=90;varbrazo_d-=velocidad)
  {
    Serial.println(varbrazo_d);
    brazo_d.write(varbrazo_d);
    delay(15);
  }
          for(varbrazo_i;varbrazo_i<=100;varbrazo_i+=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
   cinco();
  cincoderecha();
          for(varbrazo_d;varbrazo_d>=90;varbrazo_d-=velocidad)
  {
    Serial.println(varbrazo_d);
    brazo_d.write(varbrazo_d);
    delay(15);
  }
          for(varbrazo_i;varbrazo_i<=100;varbrazo_i+=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
  cinco();
  cincoderecha();
  girarizquierda();
    cinco();
  cincoderecha();
          for(varbrazo_d;varbrazo_d>=90;varbrazo_d-=velocidad)
  {
    Serial.println(varbrazo_d);
    brazo_d.write(varbrazo_d);
    delay(15);
  }
          for(varbrazo_i;varbrazo_i<=100;varbrazo_i+=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
   cinco();
  cincoderecha();
          for(varbrazo_d;varbrazo_d>=90;varbrazo_d-=velocidad)
  {
    Serial.println(varbrazo_d);
    brazo_d.write(varbrazo_d);
    delay(15);
  }
          for(varbrazo_i;varbrazo_i<=100;varbrazo_i+=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
  cinco();
  cincoderecha();
  regresarcincoderecha();
  girarderecha();
  regresarcinco();
  cincoderecha();
  girarizquierda();
  regresarcincoderecha();
  cinco();
  girarderecha();
  regresarcinco();
  //cincoderecha();
 // girarizquierda();
  //regresarcincoderecha();
  centro();
}
void bailemos(){
  cinco();
  cincoderecha();
   girarizquierda();
      for(varcuerpo;varcuerpo>=100;varcuerpo-=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarizquierda();
  girarderecha();
    for(varcuerpo;varcuerpo<=100;varcuerpo+=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarderecha();
   girarizquierda();
      for(varcuerpo;varcuerpo>=100;varcuerpo-=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarizquierda();
  girarderecha();
    for(varcuerpo;varcuerpo<=100;varcuerpo+=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarderecha();
   girarizquierda();
      for(varcuerpo;varcuerpo>=100;varcuerpo-=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarizquierda();
  girarderecha();
    for(varcuerpo;varcuerpo<=100;varcuerpo+=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarderecha();
   girarizquierda();
      for(varcuerpo;varcuerpo>=100;varcuerpo-=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarizquierda();
  girarderecha();
    for(varcuerpo;varcuerpo<=100;varcuerpo+=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarderecha();
   girarizquierda();
      for(varcuerpo;varcuerpo>=100;varcuerpo-=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarizquierda();
  girarderecha();
    for(varcuerpo;varcuerpo<=100;varcuerpo+=velocidad)
  {
    Serial.println(varcuerpo);
    cuerpo.write(varcuerpo);
    delay(15);
  }
  girarderecha();
  centro();
  regresarcinco();
  regresarcincoderecha();
   
}
void canta(){
  cinco();
  delay(7000);
  regresarcinco();
  cincoderecha();
  delay(7000);
  regresarcincoderecha();
}
void celebrar(){
        for(varbrazo_i;varbrazo_i>=30;varbrazo_i-=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
        for(varbrazo_d;varbrazo_d<=150;varbrazo_d+=velocidad)
  {
    Serial.println(varbrazo_d);
    brazo_d.write(varbrazo_d);
    delay(15);
  }
  girarderecha();
  girarizquierda();
  girarderecha();
  girarizquierda();
  girarderecha();
  girarizquierda();
  girarderecha();
  girarizquierda();
  girarderecha();
  girarizquierda();
    girarderecha();
  girarizquierda();
  centro();
  delay(6000);
   cinco();
  cincoderecha();
          for(varbrazo_d;varbrazo_d>=90;varbrazo_d-=velocidad)
  {
    Serial.println(varbrazo_d);
    brazo_d.write(varbrazo_d);
    delay(15);
  }
          for(varbrazo_i;varbrazo_i<=100;varbrazo_i+=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
   cinco();
  cincoderecha();
          for(varbrazo_d;varbrazo_d>=90;varbrazo_d-=velocidad)
  {
    Serial.println(varbrazo_d);
    brazo_d.write(varbrazo_d);
    delay(15);
  }
          for(varbrazo_i;varbrazo_i<=100;varbrazo_i+=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
   cinco();
  cincoderecha();
          for(varbrazo_d;varbrazo_d>=90;varbrazo_d-=velocidad)
  {
    Serial.println(varbrazo_d);
    brazo_d.write(varbrazo_d);
    delay(15);
  }
          for(varbrazo_i;varbrazo_i<=100;varbrazo_i+=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
   cinco();
  cincoderecha();
          for(varbrazo_d;varbrazo_d>=90;varbrazo_d-=velocidad)
  {
    Serial.println(varbrazo_d);
    brazo_d.write(varbrazo_d);
    delay(15);
  }
          for(varbrazo_i;varbrazo_i<=100;varbrazo_i+=velocidad)
  {
    Serial.println(varbrazo_i);
    brazo_i.write(varbrazo_i);
    delay(15);
  }
  centro();
  regresarcinco();
  regresarcincoderecha();
  
}


// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany) {
  while (0 < Wire.available()) { // loop through all but the last
   // char c = Wire.read(); // receive byte as a character
  //  Serial.print(c);         // print the character
  
  x = Wire.read();    // receive byte as an integer
 Serial.println(x);         // print the integer
}
}

Credits

Luis Eduardo Arenas Deseano

Luis Eduardo Arenas Deseano

2 projects • 4 followers
I am a mechatronic, in communications and electronics engineer. Specialist in IoT, mobile conectivity and service robotics.
Thanks to Jose Luis Arenas Garduza.

Comments