Introduction: Automatic Dispenser (dispensador Automático)

EAT-BOX

Is a dispenser with lights and sound activated by an application, this can be used for a multitude of situations such as a way to feed pets, or used in interactive centers to deliver food, or some other material that can enter the mechanism created .

The materials we will use are:

-servo SG5010

-sensor bluetooth HC-05

- arduino one x2

- cables

- sd module

- LEDs

- acrylic

- paperboard

- 1k resistor

-Speaker

- sd memory

-Transistor


............................................................................................................................................................................................

EAT-BOX

es un dispensador con luces y sonido activado mediante una aplicación, esta puede ser usada para una infinidad de situaciones como lo seria una forma de alimentar mascotas, o usadas en centros interactivos para entregar comida, o algún otro material que pueda entrar dentro del mecanismo creado.

los materiales que usaremos son:

-servo SG5010

-sensor bluetooth HC-05

- arduino uno x2

- cables

- modulo sd

- leds

- acrílico

- cartón

- resistencia 1k

- speaker

- memoria sd

- transistor

Step 1: Dispenser (mecanismo)

To realize the mechanism of the food dispenser,

1. first you have to choose a diameter of the mechanism that will distribute the food (it is advisable to do so in a material resistant and light

2. Two equal sides will be trimmed, sticking both 3. Following this, another circle with a diameter 2 or 3 centimeters larger than the previous one 4. The lines that are observed in the representation will be realized with small cuts of the material used for the construction of mechanism, fulfilling the function of keeping the food inside and it avoids that this escape

5. Finally, this must be brought together in the same position, with figure 2 being completely firm, whereas figure 1 will have to be attached to the servo for its free movement

............................................................................................................................................................................................

Para realizar el mecanismo del dispensador de comida,

1. primeramente se tiene que elegir un diámetro del mecanismo que va a repartir la comida (es recomendable hacerlo en un material resistente y ligero

2. Se recortarán dos lados iguales, pegándolos ambos

3. Seguido de esto se realizará otro círculo con un diámetro 2 o 3 centímetros mayor al anterior

4. Las líneas que se observan en la representación se realizarán con pequeños cortes del material usado para la construcción de mecanismo, cumpliendo la función de mantener la comida adentro y evita que esta escape

5. Por último paso se tendrá que juntar esto en una misma posición, teniendo completamente firme la figura 2, mientras que la figura 1 tendrá que estar pegada al servo para su libre movimiento

Step 2: First Arduino Connections (conexiones Del Primer Arduino)

We will start with the first arduino which will be the main base, where most connected objects will go, all these will be done by means of a protoboard and directly towards the arduino, we will begin with the main connection:

ENERGIZING THE PROTOBOARD

We will start by connecting GND to the bottom of the protoboard and 5V to the top

BLUETOOTH SENSOR HC-05

This module has 6 pins of which we will use the 4 essential for their operation these would be GND, VCC, RXD, TXD.

-GND: earth, this would be connected in the protoboard in the same line horizontally from where we previously connected GND

-VCC: power pin, here the module is fed, this would be connected in the protoboard in the same line horizontally from where we connected the 5V

-TXD and RXD: these will count towards the protoboard, and with a cable we will connect one in each one vertically, this in order to be able to send the information in a future towards both Arduinos, soon we will connect these to their counterparts in the arduino of Interleaved, the TXD cable to RXD and vice versa

SD MODULE

On the other hand, the sd module is where we store the songs that we can reproduce in the speaker, this module has 8 connections, of which we will not use the second GND and 5V, since they are not essential in this case, we start:

- 3.3V: this wired directly connected to the 3.3V of the arduino, this will give us the power of the module

- GND: earth, this would be connected in the protoboard in the same line horizontally from where we connected the GND in the moment to energize the protoboard

- CS: this will connect in the pin 10 of the arduino

-MOSI: this will connect in pin 11 of the Arduino

- SCK: I would connect on pin 13 of the Arduino

- MISO: this will be connected on pin 12 of the Arduino

LED CONNECTION

The leds in this case would be the eyes of our box, but they can be used in different situations, when you want a coordinated movement, or indicate that it is ready for use. In any case the use of these as the audio is completely optional.

The leds have 2 legs one longer than the other, so the shorter leg would be connected to GND and in this case the other leg would go to pin 5 in this case (the pin can be changed in the code)

SPEAKER CONNECTION

The speaker will be our audio output, our speaker counts is his back with two connections of positive and negative, that we can extend them by means of cables, also the loud that our speaker sounds, will be determined by the power of this one or if we buy an amplifier .

We will start by connecting a transistor in a middle part of the protoboar, with the flat face towards the front, this counts with 3 legs, where the first one will connect it directly to the GND of the protoboard, in the one of the half with the aid of a resistance We will connect to pin 9 of the arduino, and to finish the last leg would be connected to the negative part of the speaker.

On the other hand, the positive side would be connected to the 5V of the protoboard

With this we would terminate the connections of the first arduino.

............................................................................................................................................................................................

comenzaremos con el primer arduino el cual será la base principal, donde irán la mayoría de objetos conectados, todas estas se realizarán por medio de una protoboard y directamente hacia el arduino, comenzaremos con la conexión principal:


ENERGIZAR LA PROTOBOARD

comenzaremos conectando GND hacia la parte de abajo de la protoboard y 5V hacia la parte de arriba




SENSOR BLUETOOTH HC-05

este módulo cuenta con 6 pines de los cuales usaremos los 4 esenciales para su funcionamiento estos serían GND, VCC, RXD, TXD.

-GND: tierra, este iría conectado en la protoboard en la misma línea horizontalmente de donde conectamos anteriormente GND

-VCC: pin de la energía, por aquí se alimenta el modulo, este iría conectado en la protoboard en la misma línea horizontalmente de donde conectamos anteriormente los 5V

-TXD y RXD: estos los contaremos hacia la protoboard, y con un cable conectaremos uno en cada uno verticalmente, esto con el fin de poder mandar la información en un futuro hacia ambos Arduinos, luego conectaremos estos a sus contra partes en el arduino de forma intercalada, el cable TXD hacia RXD y viceversa


MODULO SD

por otro lado, el modulo sd, es donde almacenaremos las canciones que podremos reproducir en el speaker, este módulo cuenta con 8 conexiones, de las cuales no usaremos el segundo GND y 5V, ya que no son esenciales en para este caso, comenzamos:

- 3.3V: esta ira conectada directamente hacia el 3.3V del arduino, esto nos dará la energía del modulo

- GND: tierra, este iría conectado en la protoboard en la misma línea horizontalmente de donde conectamos el GND en el momento de energizar la protoboard

- CS: este lo conectaremos en el pin 10 del arduino

-MOSI: este lo conectaremos en el pin 11 del arduino

- SCK: iría conectado en el pin 13 del arduino

- MISO: este será conectado en el pin 12 del arduino


CONEXIÓN DE LEDS

los leds serian en este caso los ojos de nuestra caja, pero se pueden usar en diferentes situaciones, cuando se quiere que se haga un movimiento coordinado, o indique que está listo para el uso. En todo caso el uso de estos al igual que el audio es completamente opcional.

Los leds cuentan con 2 patas una más larga que la otra, por lo que se conectaría la pata más corta hacia GND y en este caso la otra pata iría hacia el pin 5 en este caso (el pin podemos cambiarlo en el código)

CONEXIÓN DEL SPEAKER

El speaker será nuestra salida de audio, nuestro speaker cuenta es su parte de atrás con dos conexiones de positivo y negativo, que podremos alargarlas mediante cables, además lo fuerte que suene nuestro speaker, será determinado por el poder de este o si compramos un amplificador.

Comenzaremos por conectar un transistor en una parte media de la protoboar, con la cara plana hacia el frente, esta cuenta con 3 patas, donde la primera la conectaremos directamente hacia el GND de la protoboard, en la de la mitad con ayuda de una resistencia conectaremos hacia el pin 9 del arduino, y para finalizar la última pata iría conectada hacia la parte negativa del speaker.

Por otro lado, el lado positivo seria conectado hacia los 5V de la protoboard

con esto terminariamos las conexiones del primer arduino

Step 3: Code of the First Arduino (Codigo Del Primer Arduino)

Here we show you how to create the code to be able to handle everything at the same time, we will start for the code of the first arduino, which will allow us to handle the leds and the audio, besides the bluetooth sensor.

First of all, in our arduino program we must install the library for the sd module and be able to save the audios, this would be of the following form

Entering program / include libraries / manage libraries / of hay in the browser we will put the following: tmrpcm and install it

The #include <> is used to add libraries to your Arduino code. The libraries with information modules that you need to use certain external components to Arduino, in our case we must add the module sd, the speaker in this way.

#include

#include

Then we start by defining the pin of the sd module, we can modify it by changing the final number

#define SD_ChipSelectPin 10

Now we will start naming what we will use to be able to identify them at the moment of working with them

TMRpcm tmrpcm;

Char mychar;

Arduino setup, is the method that is activated at the time that the arduino is understood, from here is where we start to be able to receive information from the pins and you have to put them in different ways

So we would add the speaker, the leds and the serial, plus an if state to have more sd control

Void setup () {

Tmrpcm.speakerPin = 9;

Serial.begin (9600);

PinMode (5, OUTPUT);

Myservo.attach (7);

If (! SD.begin (SD_ChipSelectPin)) {

Serial.println ("SD fail");

Return;

}

}

The Loop is a method that is activated after the setup, but this is constantly activated, that is, every time it finishes its processes is re-run. Here initially we look at whether the Serial is enabled, if enabled we initialize a character called a, to save the information provided from the cell to the bluetooth HC-05. Then we ask for the value that it has and according to the result, it would be used to move everything, on and off.

Void loop ()

If (Serial.available ()) {

Mychar = Serial.read ();

If (mychar == 'a') {

moverTodo ();

}

If (mychar == 'b') {

encendido();

}

If (mychar == 'c') {

apagado();

}

}

}

In the methods (moverTodo, Encendido, apagado) we will use it to turn on the music and the LEDs at the same time.

Void moverTodo() {

Tmrpcm.play ("");

DigitalWrite (5, HIGH);

Delay (5000);

Tmrpcm.stopPlayback ();

Tmrpcm.play ("");

DigitalWrite (5, LOW);

}

Void encendido () {

Tmrpcm.play ("");

DigitalWrite (5, HIGH);

Delay (5000);

}

Void apagado () {

DigitalWrite (5, LOW);

Tmrpcm.stopPlayback ();

}

IMPORTANT: they must put exactly the name of the song tmrpcm.play (""); Inside quotation marks ending in .wav

The final code would look like this, the audio files in this example are called saludos. WAV musica2.wav bien.wav

#include // need to include the SD library

// # define SD_ChipSelectPin 53 // example uses hardware SS pin 53 on Mega2560

// using digital pin 4 on arduino nano 328

#include // also need to include this library ...

#include

#define SD_ChipSelectPin 10

Servant myservo;

TMRpcm tmrpcm; // create an object for use in this sketch

Char mychar;

Void setup () {

Tmrpcm.speakerPin = 9; // 11 on Mega, 9 on One, Nano, etc.

Serial.begin (9600);

PinMode (5, OUTPUT);

Myservo.attach (7);

If (! SD.begin (SD_ChipSelectPin)) {// see if the card is present and can be initialized:

Serial.println ("SD fail");

Return;

} // do not do anything more if not

}

Void loop () {

If (Serial.available ()) {

Mychar = Serial.read ();

If (mychar == 'a') {

moverTodo ();

}

If (mychar == 'b') {

encendido();

}

If (mychar == 'c') {

apagado();

}

}

}

Void moverTodo () {

Tmrpcm.play ("saludos.wav");

DigitalWrite (5, HIGH);

Myservo.write (90);

Delay (1000);

Myservo.write (20);

Delay (4000);

Tmrpcm.stopPlayback ();

Tmrpcm.play ("musica2.wav");

DigitalWrite (5, LOW);

}

Void encendido () {

Tmrpcm.play ("bienwav");

DigitalWrite (5, HIGH);

Myservo.write (90);

Delay (1000);

Myservo.write (20);

Delay (4000);

}

Void apagado () {

DigitalWrite (5, LOW);

Tmrpcm.stopPlayback ();

}

...................................................................................................................................................................................

Aquí te mostraremos como crear el código para poder manejar todo al tiempo, comenzaremos para el código del primer arduino, que nos permitirá manejar los leds y el audio, además del sensor bluetooth.

Primero que nada, en nuestro programa arduino debemos instalar la librería para el modulo sd y poder guardar los audios, esto seria de la siguiente f7orma

Entrando a programa/incluir librerías/gestionar librerías /de hay en el buscador pondremos lo siguiente: tmrpcm e instalarlo

El #include<> se utiliza para agregar librerías a tu código de Arduino. Las librerías con módulos de información que necesitas para utilizar ciertos componentes externos a Arduino, en nuestro caso deberemos agregar el modulo sd, el speaker de esta forma.

#include

#include

Luego empezamos por definir el pin del módulo sd, este podremos modificarlo de cambiando el número final

#define SD_ChipSelectPin 10

Ahora comenzaremos a nombrar lo que usaremos para poderlos identificar al momento de trabajr con ellos

TMRpcm tmrpcm;

char mychar;

el setup de arduino, es el método que se activa al momento que en el arduino se entiende, desde aquí es donde iniciaremos para poder recibir información de los pines y hay que ponerlos de diferentes maneras

asi que añadiríamos el speaker, los leds y el serial, mas un estado de if para tener mayor control de la sd

void setup(){

tmrpcm.speakerPin = 9;

Serial.begin(9600);

pinMode(5,OUTPUT);

myservo.attach(7);

if (!SD.begin(SD_ChipSelectPin)) {

Serial.println("SD fail");

return;

}

}

El Loop, es un método que se activa luego del setup, pero este se activa constantemente, es decir, cada vez que termina sus procesos se vuelve a ejecutar. Aquí inicialmente miramos si el Serial está habilitado, si está habilitado inicializamos un Carácter llamado a, para guardar la información proporcionada desde el celular al bluetooth HC-05. Luego preguntamos el valor que posee a y según el resultado, se utilizaría moverTodo, encendido y apagado.

void loop(){

if(Serial.available()){

mychar = Serial.read();

if(mychar == 'a'){

moverTodo();

}

if(mychar == 'b'){

encendido();

}

if(mychar == 'c'){

apagado();

}

}

}

En los métodos (moverTodo,encendido, apagado) lo usaremos para encender la música y los leds al tiempo.

void moverTodo(){

tmrpcm.play("");

digitalWrite(5,HIGH);

delay(5000);

tmrpcm.stopPlayback();

tmrpcm.play("");

digitalWrite(5,LOW);

}

void encendido(){

tmrpcm.play("");

digitalWrite(5,HIGH);

delay(5000);

}

void apagado(){

digitalWrite(5,LOW);

tmrpcm.stopPlayback();

}

IMPORTANTE:deben poner exactamente el nombre de la canción tmrpcm.play(""); dentro de las comillas con terminación .wav

El codigo final quedaría de esta forma, los archivos de audio en este ejemplo, tienen el nombre de saludos. WAV música2.wav bueno.wav

#include // need to include the SD library

//#define SD_ChipSelectPin 53 //example uses hardware SS pin 53 on Mega2560

//using digital pin 4 on arduino nano 328

#include // also need to include this library...

#include

#define SD_ChipSelectPin 10

Servo myservo;

TMRpcm tmrpcm; // create an object for use in this sketch

char mychar;

void setup(){

tmrpcm.speakerPin = 9; //11 on Mega, 9 on Uno, Nano, etc

Serial.begin(9600);

pinMode(5,OUTPUT);

myservo.attach(7);

if (!SD.begin(SD_ChipSelectPin)) { // see if the card is present and can be initialized:

Serial.println("SD fail");

return;

}// don't do anything more if not

}

void loop(){

if(Serial.available()){

mychar = Serial.read();

if(mychar == 'a'){

moverTodo();

}

if(mychar == 'b'){

encendido();

}

if(mychar == 'c'){

apagado();

}

}

}

void moverTodo(){

tmrpcm.play("saludos.wav");

digitalWrite(5,HIGH);

myservo.write(90);

delay(1000);

myservo.write(20);

delay(4000);

tmrpcm.stopPlayback();

tmrpcm.play("musica2.wav");

digitalWrite(5,LOW);

}

void encendido(){

tmrpcm.play("bueno.wav");

digitalWrite(5,HIGH);

myservo.write(90);

delay(1000);

myservo.write(20);

delay(4000);

}

void apagado(){

digitalWrite(5,LOW);

tmrpcm.stopPlayback();

}

Step 4: Connection of the Second Arduino (conexion Del Segundo Arduino)

This arduino will anger with the same connection of the sensor bluetooth that we connected previously, we will connect of the same form the TXD and RXD

SERVO CONNECTION

In this will have the servo that will activate the distribution mechanism, the servo must not be continuous rotation, this also has 3 inputs, the brown wire would connect to the GND of the arduino, the red would be connected to the 5V of the Arduino , And finally the orange would go to pin 7 (this could also change depending on the code).

..............................................................................................................................................................................................

Este arduino ira con la misma conexión del sensor bluetooth que conectamos anteriormente, conectaremos de la misma forma el TXD y RXD


CONEXIÓN DEL SERVO

En este tendremos el servo que será el que active el mecanismo de distribución, el servo no debe ser de rotación continua, este además tiene 3 entradas, el cable café lo conectaríamos hacia el GND del arduino, el rojo iría conectado hacia los 5V del arduino, y por último el naranja iría hacia el pin 7 (esto también podría cambiar depende del código).

Step 5: Code for the Second Arduino (codigo Para El Segundo Arduino)

Here we show you how to create the code to be able to handle everything at the same time, we will start for the code of the first arduino, which will allow us to handle the leds and the audio, besides the bluetooth sensor.

The #include <> is used to add libraries to your Arduino code. The libraries with information modules that you need to use certain external components to Arduino, in our case we must add the module sd, the speaker in this way.

#include

Now we will start naming what we will use to be able to identify them at the moment of working with them

Servant myservo;

Char mychar;

Arduino setup, is the method that is activated at the time that the arduino is understood, from here is where we start to be able to receive information from the pins and you have to put them in different ways

So we would add the servo

Void setup () {

Serial.begin (9600);

Myservo.attach (7);

}

The Loop is a method that is activated after the setup, but this is constantly activated, that is, every time it finishes its processes is re-run. Here initially we look at whether the Serial is enabled, if enabled we initialize a character called a, to save the information provided from the cell to the bluetooth HC-05. Then we ask the value that it possesses to and according to the result,Would be used moverTodo, encendido y apagado.

void loop(){

if(Serial.available()){

mychar = Serial.read();

if(mychar == 'a'){

moverTodo();

}

if(mychar == 'b'){

encendido();

}

if(mychar == 'c'){

apagado();

}

}

}

In the methods (moverTodo,encendido, apagado) We will use it to activate the servo

void moverTodo(){

myservo.write(160);

delay(1000);

myservo.write(20);

delay(4000);

}

void encendido(){

myservo.write(160);

delay(1000);

myservo.write(20);

delay(4000);

}

void apagado(){

}

and this is a finale code

//
also need to include this library...

#include

Servo myservo;

char mychar;

void setup(){

Serial.begin(9600);

pinMode(5,OUTPUT);

myservo.attach(7);

}

void loop(){

if(Serial.available()){

mychar = Serial.read();

if(mychar == 'a'){ //send the letter p over the serial monitor to start playback

moverTodo();

}

if(mychar == 'b'){ //send the letter p over the serial monitor to start playback

encendido();

}

if(mychar == 'c'){ //send the letter p over the serial monitor to start playback

apagado();

}

}

}

void moverTodo(){

myservo.write(160);

delay(1000);

myservo.write(20);

delay(4000);

digitalWrite(5,LOW);

}

void encendido(){

myservo.write(160);

delay(1000);

myservo.write(20);

delay(4000);

}

void apagado(){

digitalWrite(5,LOW);

}

............................................................................................................................................................................................

Aquí te mostraremos como crear el código para poder manejar todo al tiempo, comenzaremos para el código del primer arduino, que nos permitirá manejar los leds y el audio, además del sensor bluetooth.

El #include<> se utiliza para agregar librerías a tu código de Arduino. Las librerías con módulos de información que necesitas para utilizar ciertos componentes externos a Arduino, en nuestro caso deberemos agregar el modulo sd, el speaker de esta forma.

#include

Ahora comenzaremos a nombrar lo que usaremos para poderlos identificar al momento de trabajar con ellos

Servo myservo;

char mychar;

el setup de arduino, es el método que se activa al momento que en el arduino se entiende, desde aquí es donde iniciaremos para poder recibir información de los pines y hay que ponerlos de diferentes maneras

asi que añadiríamos el servo

void setup(){

Serial.begin(9600);

myservo.attach(7);

}

El Loop, es un método que se activa luego del setup, pero este se activa constantemente, es decir, cada vez que termina sus procesos se vuelve a ejecutar. Aquí inicialmente miramos si el Serial está habilitado, si está habilitado inicializamos un Carácter llamado a, para guardar la información proporcionada desde el celular al bluetooth HC-05. Luego preguntamos el valor que posee a y según el resultado, se utilizaría moverTodo, encendido y apagado.

void loop(){

if(Serial.available()){

mychar = Serial.read();

if(mychar == 'a'){

moverTodo();

}

if(mychar == 'b'){

encendido();

}

if(mychar == 'c'){

apagado();

}

}

}

En los métodos (moverTodo,encendido, apagado) lo usaremos para activar el servo

void moverTodo(){

myservo.write(160);

delay(1000);

myservo.write(20);

delay(4000);

}

void encendido(){

myservo.write(160);

delay(1000);

myservo.write(20);

delay(4000);

}

void apagado(){

}

y asi quedaria nuestro codigo final

//
also need to include this library...

#include

Servo myservo;

char mychar;

void setup(){

Serial.begin(9600);

pinMode(5,OUTPUT);

myservo.attach(7);

}

void loop(){

if(Serial.available()){

mychar = Serial.read();

if(mychar == 'a'){ //send the letter p over the serial monitor to start playback

moverTodo();

}

if(mychar == 'b'){ //send the letter p over the serial monitor to start playback

encendido();

}

if(mychar == 'c'){ //send the letter p over the serial monitor to start playback

apagado();

}

}

}

void moverTodo(){

myservo.write(160);

delay(1000);

myservo.write(20);

delay(4000);

digitalWrite(5,LOW);

}

void encendido(){

myservo.write(160);

delay(1000);

myservo.write(20);

delay(4000);

}

void apagado(){

digitalWrite(5,LOW);

}

Step 6: Prepare the Sound for the Sd (preparar El Sonido Para La Sd)

in this Page we will take our file and upload it and change the following parameters

-modify bit resolution to 8 bits

-the sampling rate will be between 16000hz and 32000hz

-the audio channel would go in mono

- in advanced options we changed the format pcm to PCM un-signed 8bits

This would do with all the audios that we are going to put, as a precaution, it would be ideal if the SD were only with the audio files and nothing else

............................................................................................................................................................................................

http://audio.online-convert.com/es/convertir-a-wav

en esta pagina cogeremos nuestro archivo y lo subiremos y cambiaremos los siguientes parámetros

-modificaremos la resolución de bits a 8 bits

-la tasa de muestreo la pondremos entre 16000hz y 32000hz

-el canal de audio iría en mono

- en opciones avanzadas cambiamos el formato pcm a PCM un-signed 8bits

Esto lo haríamos con todos los audios que vamos a meter, por precaución, sería idóneo que la sd estuviera solo con los archivos de audio y nada mas

Step 7: Creation of the Application (creacion De La Aplicacion)

Our application would be created from app inventor 2 http://ai2.appinventor.mit.edu
1. A new project is created from the inventor app platform

2. In connectivity options, the "BluetoothClient" is dragged to the pp screen.

3. put 2 horizontal layouts

4. put 3 vertical layauds within one of the above

5. within 2 of these we would put a button and in the third we would put a "ListPicker" that is in the part of user interface

After finishing with the interface we would go to the part of blocks where we have a system of blocks to configure the app

1. In the list on the left side you will find the "ListPicker" and click that it will open a new menu, there you will find the option that ends in ".BeforePicking" and is dragged to the screen.

2. In the same list, we search for "ListPicker" and now we look for a green option that says "set.ListPicker.Elemnts to" and it fits within the space of the previous option.

3. In the list the "BluetoothClient" module is searched and in the menu we look for "BluetoothClient.AddressesAndNames" and it fits in the previous option.

4. The "ListPicker" is searched in the list and in the new menu the option that ends in ".AfterPicking" is searched and dragged to the screen.

5. In the "ListPicker" list is searched for "Set.ListPicker.Selection.To" in green, and it fits with the previous one.

6. In the list the module is searched for "BluetoothClient" and then we look for "call.bluetoothClient.Connectaddresses" and it fits in the previous one.

7. In the list we search again for "ListPicker" and then we look for "LisPicker.Selection" and we fit it in the previous one.

Then we will configure the buttons

In the same interface where we configure the bluetooth, we will configure the buttons.

1. Look in the list for "Button1", and then "When.Button1.Click". And drag it to the screen.

2. In the list we look for "BluetoothClient" and then we search "call.BluetoothClient.SendText" and we fit with the previous one.

3. Then in the list look for "Text" and look for the option that appears in white inside quotation marks and we fit with the previous one.

So you can create the buttons you want by changing the character to what they have determined in the code in our case we would need 3, (a, b, c)

............................................................................................................................................................................................

nuestra aplicacion seria creada desde app inventor 2 http://ai2.appinventor.mit.edu

1. Se crea un nuevo proyecto desde la plataforma app inventor

2. En opciones de conectividad se arrastra hasta la pantalla de la pp el “BluetoothClient”

3. pondremos 2 layouts horizontales

4. pondremos 3 layauds verticales dentro de uno de los anteriores

5. dentro de 2 de estos meteríamos un botón y en el tercero pondríamos un “ListPicker” que se encuentra en la parte de interfaz de usuarios

Luego de terminar con la interfaz iríamos a la parte de bloques donde tenemos un sistema de bloques para configurar la app

1. En la lista de la parte izquierda se busca el “ListPicker” y se click que abrirá un nuevo menú, allí se busca la opción que termine en “.BeforePicking” y se arrastra a la pantalla.

2. En la misma lista se vuelve a buscar “ListPicker” y ahora buscamos una opción en color verde que diga “set.ListPicker.Elemnts to” y se encaja dentro del espacio de la opción anterior.

3. En la lista se busca el módulo “BluetoothClient” y en el menú buscamos “BluetoothClient.AddressesAndNames” y se encaja en la anterior opción.

4. Se busca en la lista el “ListPicker” y en el nuevo menú se busca la opción que termina en “.AfterPicking” y se arrastra a la pantalla.

5. En el “ListPicker” de la lista se busca “Set.ListPicker.Selection.To” en verde, y se encaja con la anterior.

6. En la lista se busca el módulo de “BluetoothClient” y luego buscamos “call.bluetoothClient.Connectaddresses” y se encaja en la anterior.

7. En la lista buscamos nuevamente a “ListPicker” y luego buscamos “LisPicker.Selection” y la encajamos en la anterior.

Luego configuraremos los botones

En la misma interfaz donde configuramos el bluetooth, configuraremos los botones.

1. Buscamos en la lista el “Button1”, y luego “When.Button1.Click”. y la arrastramos a la pantalla.

2. En la lista buscamos “BluetoothClient” y luego buscamos “call.BluetoothClient.SendText” y encajamos con el anterior.

3. Luego en la lista buscamos “Text” y buscamos la opción que aparece en blanco dentro de comillas y la encajamos con la anterior.

Así pueden crear los botones que quieran cambiando el carácter a lo que tienen determinado en el código en nuestro caso necesitaríamos 3, (a,b,c)