Bluetooth & AppInventor (1)

Español

Hoy vamos a comentar como crear app con AppInventor para la comunicación con Arduino

En esta entrada conectaremos el módulo bluetooth de Arduino del articulo anterior con el bluetooth del telefono móvil a través de una app creada con AppInventor.

Para ello crearemos primero un pequeño programa para Arduino de tal manera que al enviar una orden a través de Bluetooth realice alguna acción la placa. En nuestro caso será encender un led , que sería la acción más sencilla .

El programa que usaremos será el siguiente:

 
#include 

#define txPin 3 // definimos txpin en que pin de arduino se encuentra
#define rxPin 2 // definimos rxpin en que pin de arduino se encuentra 

SoftwareSerial bluetooth(rxPin, txPin); // el puerto nuevo de comunicacion se llamar bluetooth

char NOMBRE[10]  = "TEST1";  // asignamos un nombre a nuestro modulo bluetooth para cuando lo veamos en linea 
char BPS         = '4';           // 1=1200 , 2=2400, 3=4800, 4=9600, 5=19200, 6=38400, 7=57600, 8=115200
char PASS[10]    = "1234";   // password para realizar la conexion. Sino funciona 0000
 
char INBYTE;
int  LED = 13; // LED on pin 13 // hacemos que el led 13 de Arduino integrado nos sirva de prueba

void setup() {
  Serial.begin(9600); // velocidad de la comunicacion entre arduino y ordenador 
 Serial.println("Estoy preparado"); //mensaje de comprobacion
   pinMode(LED, OUTPUT);
  bluetooth.flush();            // Borramos el buffer del serial para evitar errores
  pinMode(rxPin, INPUT);     // Configuramos los pines del bluetooth 
  pinMode(txPin, OUTPUT);
  bluetooth.begin(9600);  // marcamos la velocidad del puerto bluetooth 

}
 
void loop()
{
  while (!bluetooth.available());   // mientras el puerto este disponible ejecuta el programa
  INBYTE = bluetooth.read();        // lee la comunicacion bluetooth
  if( INBYTE == '2' ) 
    {
      digitalWrite(LED, LOW);  // si pulsas el numero 3 escribe en el led apagado

      bluetooth.println("Has presionado 2"); //muestra en el ordenador que tecla se ha pulsado
    }
  if( INBYTE == '1' ) 
  {
    digitalWrite(LED, HIGH); // si pulsas el numero 4 escribe led encendido
    bluetooth.println("Has presionado 1");
  }
  delay(50);
  
}
 

La líniea "if INBYTE ==…. then …" nos indica que pasará si se pulsa 1 o 2 , en nuestro caso si pulsamos el botón de la app ON o OFF enviamos ese caracter a través de Bluetooth. 

(Descarga del programa)

Una vez tenemos claro el programa vamos a crear la app. Accedemos a AppInventor nuevo proyecto y colocaremos dos botones, uno para la activación del LED (ON) y otro para la desactivación (OFF)

Seguidamente cambiaremos el nombre de los botones (opcional)

Colocamos los botones de alineados horizontalmente

Añadimos la "lista" del botón conexión, el cual cambiará de color al realizar la conexión bluetooth (es por ello que no es un simple botón)

Añadimos el Bluetooth (nos aparece como elemento externo a la pantalla en la parte inferior)

Después de esto accedemos al apartado de bloques (parte superior derecha) para poder "programar" nuestra app

Este es el bloque de programación del Bluetooth . En el podemos ver como comprobamos la conexión Bluetooth y si es correcta el "botón" de Bluetooth nos aparecerá en azul. 

Estos dos bloques inferiores son el envio del caracter "1" y el caracter "2" para la activación del LED de la placa Arduino. Como veis podemos enviar cualquier caracter, así que añadir mas funciones a la placa de Arduino nos resultará bastante sencillo.

Una vez seguidos estos pasos crearemos el codigo QR , o descargaremos la app como más nos convenga :

Al ejectutar la app en el telefono pulsaremos el botón "conexión" y veremos que aparece la MAC del bluetooth y realiza la conexión (previo código 1234 o 1111 normalmente) . El led rojo del módulo bluetooth dejará de parpadear indicando que ha realizado la conexión.

Probaremos los botones de ON y OFF y veremos como se enciende y se apaga el led de la placa Arduino.

Y ya está, ya tenemos nuestra primera app y el control ON/OFF de un led en Arduino.

 

Un saludo y hasta la próxima.

Comentarios

Real Kamagra [url=http://eclatrx.com]kamagra price thailand[/url] Levitra Kaufen In Osterreich Levaquin 250mg In Internet Livraison Cialis En 24 Heures Pharmacie Cialis Viagra Buying Citalopram Online Uk [url=http://cure-rx.com]cialis online[/url] Buy Dilantin No Script Vente Propecia Canada Viagra Usa Overnight Delivery [url=http://binotal.com]viagra[/url] Amantadine Viagra Mode Emploi Keflex With Dogs Amoxicillin Dreams [url=http://rx2day.com]viagra[/url] Amoxicillin Dosage For Preschoolers Amoxicillin Dosing Can I Buy Zithromax At Walmart Cheap Viagra .Can 400mg Viagra Et Cannabis [url=http://e-rxnow.com]levitra online order[/url] Amoxicillin And Drug And Test Drug Tadalis Sx Soft Cialis Generika Versand Deutschland Amoxicillin Strep Throat [url=http://frigra.com]cialis online[/url] Venda De Viagra Online Tipos De La Propecia Cialis 5 Mg Diario Precio Donde Comprar Cialis [url=http://rx-free.com]viagra[/url] Celebrex From Canada Zithromax Amazon Zithromax Pregnancy How To Buy Macrobid [url=http://cheap-x.com]viagra[/url] Purchase Accutane Online Buy Cialis Uk Cheap Gpchealth Generic Viagra Mastercard The Most Inexpensive Cialis [url=http://bneatar.com]cheap cialis[/url] Pallet And Amoxicillin Priligy Cialis Acheter Kamagra Livraison 24h Propecia Long Hair [url=http://call4ph.com]viagra online[/url] Amoxicillin Alcohol Interaction Ciprofloxacin Functional Groups Quand Commencer Nolvadex Apres Deca Vendo Kamagra Estado Should Keflex Be Taken With Milk [url=http://drugsxn.com]canadian healthcare mall levitra[/url] Costo Cialis Cialis Ohne Verpackung Propecia Rinon Levitra Kamagra Motilium Otc [url=http://bedrugs.net]buy viagra[/url] Provera Website Amex Overseas Amoxil Bon Can I Buy Viagra Without A Prescription [url=http://339-go.com]Cheap Viagra[/url] Viagra Rezeptfrei Acticin By Money Order Paul A Vendre Levitra En Ligne [url=http://ciaolis.com]cialis[/url] Propecia Desventajas Low Priced Cialis Brand Prednisone Online Fedex Shipping Zentel For Sale [url=http://durazy.com]Buy Viagra[/url] Come Acquistare Viagra Bactrim Ds Without An Rx Canadian Pharcharmy Online Viagra Cephalexin 500 Mg Dosages Tev [url=http://aspills.com]cialis[/url] Propecia While On Propecia Drug Best Levitra Prices Keflex For An Abscessed Tooth Viagra Significato [url=http://call4ph.com]viagra online[/url] Order Elocon Best Website Overseas Amoxicillin Cat Germany domperidone [url=http://demalan.com]buy viagra[/url] Cialis Canada Genericos Propecia Levitra Tradizionale Azithromycin 1 Gram Oral Packet Vendita Viagra Napoli [url=http://eulexin.net]viagra[/url] Misoprostol Portugal Levitra 20 Mg Durata Effetto Drugstore Xenical Buy 500 Mg Keflex [url=http://drugsir.com]cialis[/url] Levitra 10 Mgen Bayer Cephalexin Metformin Buyrealviagraonlihenoperscription

Yes! Finally someone writes about og baller.

My web-site ... kerser - http://emceekerser.com/

Do you have a spam issue on this website; I also am a blogger, and I was curious about
your situation; many of us have developed some nice practices and we are looking to trade solutions
with others, please shoot me an email if
interested.

Visit my blog - og baller - http://emceekerser.com/

Hi friends, how is all, and what you wish for to say
about this paragraph, in my view its in fact remarkable designed for me.

my webpage ... og baller - http://emceekerser.com/

After I initially left a comment I appear to have clicked on the -Notify me when new comments
are added- checkbox and from now on each time a comment is added I recieve four emails with
the same comment. There has to be a means you are able to remove me from that service?
Kudos!

Feel free to visit my web page; og baller - http://emceekerser.com/

Its like you read my thoughts! You appear to understand so much about this,
like you wrote the ebook in it or something. I think that you simply can do
with a few percent to force the message home a little bit, but instead of that, that is wonderful blog.
A great read. I'll certainly be back.

Also visit my web site; kerser - http://emceekerser.com/

I think that what you posted was actually very reasonable.

But, think on this, what if you composed a catchier
title? I am not suggesting your information isn't
good, however what if you added a post title that grabbed folk's attention? I mean Añadir nuevo comentario | gerdsLAB
is kinda vanilla. You should peek at Yahoo's front page and watch how they create article headlines to grab people interested.
You might try adding a video or a pic or two to grab readers interested about what you've written.
Just my opinion, it would bring your posts a little bit more interesting.

Look into my web site ... og baller - http://emceekerser.com/

I used to be able to find good info from your blog articles.

Here is my page: og baller - http://emceekerser.com/

Awesome article.

Check out my web-site ... og baller - http://emceekerser.com/

I am not sure where you're getting your info, but good
topic. I needs to spend some time learning much more or understanding more.
Thanks for fantastic info I was looking for this info for my mission.

my web site :: og baller - http://emceekerser.com/

Wow, superb blog layout! How long have you been blogging for?
you make blogging look easy. The overall look of your website is fantastic, let alone the content!

My webpage; kerser - http://emceekerser.com/

I'm not sure why but this blog is loading extremely slow
for me. Is anyone else having this issue or is it a problem on my end?

I'll check back later on and see if the problem still exists.

Stop by my webpage - og baller [ Kristina - http://emceekerser.com/ ]

What's Happening i'm new to this, I stumbled upon this I've found It absolutely helpful and it has aided me out loads.
I'm hoping to contribute & assist different customers
like its helped me. Good job.

Here is my blog post; og baller - http://emceekerser.com/

What's up, I check your blogs on a regular basis.
Your story-telling style is awesome, keep it up!

Here is my blog - og baller - http://emceekerser.com/

Thanks for one's marvelous posting! I quite enjoyed reading it, you're a great author.
I will make certain to bookmark your blog and may come back
later in life. I want to encourage you continue your great work,
have a nice weekend!

My homepage ... kerser - http://emceekerser.com/

Asking questions are truly nice thing if you are not understanding
anything fully, however this article presents good understanding even.

my blog: og baller - http://emceekerser.com/

hey there and thank you for your information –
I've certainly picked up something new from right here. I did however expertise
some technical points using this website, as I experienced to reload the web
site many times previous to I could get it to load correctly.
I had been wondering if your web host is OK? Not that I am complaining, but sluggish loading instances
times will sometimes affect your placement in google and could damage your high quality
score if ads and marketing with Adwords. Well I am adding this RSS to
my e-mail and can look out for much more of your respective exciting content.

Ensure that you update this again very soon.

Feel free to surf to my blog post; og baller - http://emceekerser.com/

Fabulous, what a website it is! This blog presents helpful information to
us, keep it up.

Feel free to visit my weblog: og baller - http://emceekerser.com/

I was suggested this web site via my cousin. I
am not sure whether this publish is written via him as nobody else recognise such particular about my difficulty.

You're wonderful! Thank you!

Also visit my web-site ... kerser - http://emceekerser.com/

Thanks for some other great post. The place else may just
anyone get that kind of information in such a perfect way of
writing? I have a presentation subsequent week, and I'm on the look for such info.

my site - kerser - http://emceekerser.com/

Appreciate this post. Let me try it out.

Feel free to visit my page; kerser - http://emceekerser.com/

I am genuinely thankful to the owner of this web page who has shared
this great post at here.

my webpage: og baller ( Jed - http://emceekerser.com/ )

Have you ever thought about including a little bit more than just your articles?
I mean, what you say is valuable and everything.
Nevertheless just imagine if you added some great visuals or videos to give your posts more, "pop"!
Your content is excellent but with images and video clips, this website could certainly
be one of the best in its field. Terrific blog!

Here is my blog: og baller - http://emceekerser.com/

Hi, all is going sound here and ofcourse every one
is sharing data, that's genuinely fine, keep up writing.

Here is my web-site og baller - http://emceekerser.com/

Heya i am for the first time here. I found this board and I find It
really useful & it helped me out much. I hope to give something back
and help others like you aided me.

Here is my web site - og baller ( Keeley - http://emceekerser.com/ )

Tremendous issues here. I'm very glad to peer your article.
Thanks a lot and I am having a look ahead to
touch you. Will you kindly drop me a e-mail?

Check out my web page: og baller - http://emceekerser.com/

I'm impressed, I have to admit. Rarely do I encounter a blog that's equally educative and entertaining, and without a
doubt, you have hit the nail on the head. The problem is something that not enough folks
are speaking intelligently about. I am very happy that I found this
in my hunt for something relating to this.

Look at my weblog: og baller - http://emceekerser.com/

For most recent news you have to pay a quick visit world wide
web and on the web I found this web page as a finest website for
most recent updates.

Review my web-site :: kerser - http://emceekerser.com/

If you want to obtain a good deal from this article then you have to apply these strategies to your won webpage.

Review my blog :: og baller - http://emceekerser.com/

I loved as much as you'll receive carried out right here.
The sketch is tasteful, your authored subject matter
stylish. nonetheless, you command get bought an shakiness over
that you wish be delivering the following. unwell unquestionably come further formerly again as exactly the same nearly a lot often inside
case you shield this hike.

my weblog ... og baller - http://emceekerser.com/

You're so interesting! I don't suppose I've truly read something like this
before. So great to discover somebody with genuine thoughts on this topic.
Really.. thanks for starting this up. This site is one thing that is required on the web, someone
with a bit of originality!

Feel free to surf to my blog :: kerser - http://emceekerser.com/

Its not my first time to go to see this web site, i am browsing this web
page dailly and obtain nice information from here every day.

Here is my site ... og baller - http://emceekerser.com/

I will right away take hold of your rss feed as I can not to find your e-mail subscription link or
newsletter service. Do you've any? Please permit me understand in order
that I may just subscribe. Thanks.

Here is my website og baller - http://emceekerser.com/

bookmarked!!, I love your blog!

Also visit my web blog: og baller ( Claudia - http://emceekerser.com/ )

Howdy! This blog post could not be written any better! Looking through this article reminds me
of my previous roommate! He always kept preaching about this.

I am going to send this article to him. Fairly certain he's going to have a great read.
Many thanks for sharing!

My web page: og baller; Sheryl - http://emceekerser.com/ ,

Write more, thats all I have to say. Literally, it seems as though
you relied on the video to make your point. You clearly know what youre talking about, why waste your
intelligence on just posting videos to your blog when you
could be giving us something enlightening to read?

Look at my blog post kerser - http://emceekerser.com/

Great blog! Is your theme custom made or did you download it from somewhere?
A theme like yours with a few simple tweeks would really make my blog jump out.
Please let me know where you got your design. Kudos

my web blog; kerser - http://emceekerser.com/

Hello There. I found your blog using msn. This is a very well written article.

I'll be sure to bookmark it and return to read more
of your useful information. Thanks for the post.
I will certainly comeback.

my page ... og baller - http://emceekerser.com/

I know this web page gives quality depending articles or reviews and
other material, is there any other web page which offers such stuff in quality?

Also visit my web site: og baller - http://emceekerser.com/

Hello! I know this is somewhat off topic but I was wondering which blog platform are you using for
this site? I'm getting sick and tired of Wordpress because I've had
problems with hackers and I'm looking at options for another platform.
I would be great if you could point me in the direction of a good
platform.

Here is my page: og baller - http://emceekerser.com/

Hi there I am so glad I found your blog page, I really found
you by error, while I was looking on Google for something else, Anyhow I am here now and would just
like to say thank you for a fantastic post and a
all round thrilling blog (I also love the theme/design),
I don't have time to browse it all at the minute but I have bookmarked it and also added in your RSS feeds, so when I have
time I will be back to read much more, Please do keep up the
superb work.

Check out my blog - og baller - http://emceekerser.com/

Wow, this paragraph is pleasant, my sister is analyzing such things,
therefore I am going to inform her.

Here is my blog; og baller - http://emceekerser.com/

I have to thank you for the efforts you have put in writing this website.
I'm hoping to view the same high-grade content by you later on as well.

In fact, your creative writing abilities has motivated me to get
my very own website now ;)

My web-site ... og baller ( Johnette - http://emceekerser.com/ )

I have been browsing on-line greater than 3 hours these days,
yet I by no means discovered any fascinating article like yours.
It is lovely worth sufficient for me. Personally, if all site owners and bloggers made good content material as you
probably did, the internet will be a lot more helpful than ever before.

Here is my weblog og baller - http://emceekerser.com/

Hi there mates, nice post and good urging
commented here, I am really enjoying by these.

Review my blog ... og baller, Emely - http://emceekerser.com/ ,

This post is actually a pleasant one it helps new web people, who are
wishing for blogging.

Here is my website og baller - http://emceekerser.com/

I simply could not leave your site before suggesting
that I extremely enjoyed the usual information a person provide in your
guests? Is gonna be back incessantly to investigate cross-check new posts

Have a look at my blog :: og baller - http://emceekerser.com/

Aw, this was a very good post. Finding the time and actual effort to generate a very good
article… but what can I say… I hesitate a whole lot and don't seem to get
anything done.

My webpage; og baller - http://emceekerser.com/

Hello! This is my first comment here so I just wanted
to give a quick shout out and tell you I really enjoy reading through your articles.
Can you suggest any other blogs/websites/forums that cover the
same subjects? Thanks for your time!

Stop by my web site og baller ( Jacklyn - http://emceekerser.com/ )

I was wondering if you ever considered changing the layout of your website?
Its very well written; I love what youve got to say.

But maybe you could a little more in the way of content so people could connect with it better.
Youve got an awful lot of text for only having 1 or 2
pictures. Maybe you could space it out better?

Stop by my page; og baller - Niamh - http://emceekerser.com/ -

Páginas

Añadir nuevo comentario

Plain text

  • No se permiten etiquetas HTML.
  • Las direcciones de las páginas web y las de correo se convierten en enlaces automáticamente.
  • Saltos automáticos de líneas y de párrafos.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.