Bluetooth & AppInventor (1)

 

Hello, today we're gonna explain ho to create an app with Appinventor and how to communicate it with Arduino . We connect bluetooth module to Arduino like we told you at  last post with mobile's bluetooth trought a simple app with Appinventor.

First we create a little program for Arduino, only to send an order via Bluetooth and do something easy with Arduino board, for example switch LED on/off .

We will use the next program : 

 

#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);
  
}
 
The line "if INBYTE ==…. then …" told us what happend when you push 1 or 2 on keyboard. If you push 1 on app button then switch ON LED and when you push 2 on app button then switch OFF LED. 

(Download program)

Now e have finished the program, let's go to create the app on Appinventor. We create a new project and we drag and drop two buttons, one dor switch ON and switch OFF.

Now we change the name of the buttons (optional) 

We arrange the buttons horitzontaly

We add a "list pick" to create the "bluetooth connect button". The button will change the color when bluetooth is active (that's it because we need a list pick instead a simple button)

We add bluetooth to screen 

After that we work with Block Appinventor (top right) and we start to program our app.

This is the bluetooth block . We could see that we check the bluetooth connection first and if is correct the bluetooth change to blue color. 

The two last blocks are create to send the character "1" and "2" to switch ON or OFF our LED in the Arduino board. As you can see we can send whatever character you want, then you could add more functions to send at arduino board. 

After these steps we create a QR code  , we download the app to mobile 

When we open th app we push "conexión" and we could see the MAC of bluetooth module. Then we connect (maybe you have to use the password 1234 or 1111 ). The red led on bluetooth module stops blinking and then is connect correctly.

We test the buttons ON and OFF and we could see how it switch ON or OFF LED

 

See you in the next article

English

Comments

Fastidious answer back in return of this matter with solid arguments and explaining all on the topic of that.

Feel free to surf to my blog - wwe royal rumble 2017 online - http://www.royalrumbleresults.org

European research has shown that the majority of men overly concerned or afraid of
changing and showering in mens locker rooms have similar backgrounds in that they were either raised in a household with a weak, inaffectual father or
raised entirely by a woman.

Review my blog post; destin snorkel - http://www.destinsnorkel.com/

If some one desires expert view concerning blogging then i advise
him/her to pay a visit this webpage, Keep up the fastidious job.

Look at my webpage: Christianity - http://itckt.ru/user/KassandraBurwell/

Currently it looks like Expression Engine is the best blogging
platform available right now. (from what I've read) Is that what you are using on your blog?

Feel free to surf to my blog post: buy followers on Twitter; Flora
- http://twittertips.shotblogs.com/the-value-of-having-twitter-followers-1... ,

Hi there, this weekend is pleasant for me, as this occasion i
am reading this fantastic informative piece of writing here at my residence.

Here is my blog post ... sports betting - http://weaponsofvirtue.info/WoV/index.php?title=User:DavidaThomas

Hi, every time i used to check webpage posts here in the early hours in the dawn, as
i enjoy to gain knowledge of more and more.

My website; Lord Grabiner - https://www.parliament.uk/documents/commons-committees/work-and-pensions...

Hello! Do you know if they make any plugins to safeguard against
hackers? I'm kinda paranoid about losing everything
I've worked hard on. Any tips?

my webpage: http://www.betting-casinos.com - http://www.damisoft.ch/wiki/index.php?title=Benutzer:ReinaJageurs5

Its such as you read my mind! You seem to understand so much approximately this, like you wrote the
book in it or something. I believe that you just
can do with some percent to pressure the message home a
bit, but other than that, that is magnificent blog. A great read.
I will definitely be back.

Feel free to visit my page: sports betting - http://www.borderdata.com/index.php/User:AmelieWestbury

I'm extremely impressed with your writing skills as well as with the layout on your weblog.

Is this a paid theme or did you modify it yourself?
Anyway keep up the nice quality writing, it is rare to see a nice blog like this
one nowadays.

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

Hmm it appears like your website ate my first comment (it was super long) so
I guess I'll just sum it up what I had written and say,
I'm thoroughly enjoying your blog. I as well am an aspiring blog
blogger but I'm still new to the whole thing. Do
you have any tips and hints for first-time blog writers?
I'd certainly appreciate it.

Here is my webpage ... kerser - http://emceekerser.com/

Amazing! Its really awesome post, I have got much clear idea concerning from this post.

My site ... og baller [ Lora - http://emceekerser.com/ ]

I have fun with, result in I discovered just what I
was looking for. You've ended my 4 day lengthy
hunt! God Bless you man. Have a nice day. Bye

My blog post: og baller, Owen - http://emceekerser.com/ ,

Hiya very nice blog!! Man .. Beautiful .. Superb .. I will bookmark your site and take the feeds additionally?
I am glad to seek out numerous useful information here within the post, we need work out extra techniques
in this regard, thank you for sharing. . . . .
.

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

I am really impressed with your writing skills as well as with the layout on your blog.

Is this a paid theme or did you modify it yourself? Either way keep up the nice quality writing, it's rare to see a nice blog like this one these days.

Here is my page ... kerser - http://emceekerser.com/

Hi there just wanted to give you a brief heads up and let
you know a few of the images aren't loading properly.

I'm not sure why but I think its a linking issue.
I've tried it in two different internet browsers and both show the same outcome.

Visit my website: og baller ( Rosemarie - http://emceekerser.com/ )

Thank you for the auspicious writeup. It in fact was a amusement account it.
Look advanced to more added agreeable from you!
However, how could we communicate?

Here is my web page; og baller [ Keenan - http://emceekerser.com/ ]

I enjoy what you guys are usually up too.
This type of clever work and coverage! Keep up the very good
works guys I've added you guys to my own blogroll.

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

This info is priceless. How can I find out more?

Also visit my homepage - kerser - http://emceekerser.com/

This is really interesting, You're a very skilled blogger.
I've joined your feed and look forward to seeking more of your great post.

Also, I have shared your web site in my social networks!

my webpage :: og baller [ Viola - http://emceekerser.com/ ]

Very descriptive blog, I liked that bit. Will there be a part 2?

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

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

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

I was able to find good information from your blog posts.

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

What's up to every one, because I am actually eager of reading this
web site's post to be updated daily. It consists of pleasant data.

Also visit my blog post - og baller - http://emceekerser.com/

When I originally commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get four e-mails with the same comment.
Is there any way you can remove me from that service?
Cheers!

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

Hey are using Wordpress for your blog platform? I'm new to the blog world but
I'm trying to get started and create my own. Do you need any html coding expertise to make your own blog?
Any help would be really appreciated!

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

We stumbled over here from a different web page and thought I might as
well check things out. I like what I see
so now i'm following you. Look forward to going over your web page yet again.

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

There's definately a great deal to find out about this topic.
I love all the points you have made.

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

I was excited to uncover this site. I need to to thank you for your
time just for this fantastic read!! I definitely liked every part of it and I have
you book-marked to check out new stuff in your website.

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

I just could not go away your site before suggesting that
I extremely enjoyed the usual information a person provide to
your visitors? Is going to be again often in order to investigate cross-check new posts

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

Have you ever considered about including a little bit
more than just your articles? I mean, what you say is valuable and all.
Nevertheless imagine if you added some great photos or videos to give your posts more, "pop"!
Your content is excellent but with images and clips, this site
could undeniably be one of the best in its niche.

Excellent blog!

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

You should be a part of a contest for one of the greatest websites
on the net. I will recommend this web site!

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

Hi there, just became aware of your blog through Google, and found
that it's really informative. I'm gonna watch out for brussels.
I'll appreciate if you continue this in future.
Lots of people will be benefited from your writing. Cheers!

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

The other day, while I was at work, my sister stole my iPad
and tested to see if it can survive a thirty foot
drop, just so she can be a youtube sensation. My apple ipad is now broken and she has 83 views.
I know this is totally off topic but I had
to share it with someone!

Feel free to surf to my web page; forex trading platforms
- http://www.jireh-capital.com/

Hi! Do you use Twitter? I'd like to follow you if that
would be okay. I'm undoubtedly enjoying your blog
and look forward to new posts.

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

Hello There. I discovered your weblog the use of msn. That
is a really well written article. I will be sure to bookmark it and
return to learn extra of your helpful info. Thanks for the post.
I'll definitely return.

Here is my webpage ... kerser - http://emceekerser.com/

I just couldn't go away your site before suggesting that
I really loved the usual information a person supply to your visitors?
Is going to be again incessantly in order to check up on new posts

Also visit my blog kerser - http://emceekerser.com/

I am sure this article has touched all the internet viewers,
its really really nice piece of writing on building up new webpage.

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

Greetings, I do think your web site might be having web browser compatibility problems.
Whenever I look at your website in Safari, it looks fine but when opening in IE, it has some overlapping issues.

I merely wanted to give you a quick heads up! Other than that, excellent website!

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

It's hard to come by educated people in this particular topic,
but you seem like you know what you're talking about!
Thanks

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

hello!,I really like your writing so much! percentage we
keep up a correspondence extra approximately your
post on AOL? I require a specialist on this area to unravel
my problem. Maybe that's you! Taking a look forward to see you.

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

There's definately a lot to know about this subject. I really like all the points you've made.

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

It's appropriate time to make some plans for the
future and it is time to be happy. I've read this post and if I could I wish to suggest
you some interesting things or advice. Perhaps
you could write next articles referring to this article.
I wish to read more things about it!

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

Does your website have a contact page? I'm having trouble
locating it but, I'd like to send you an email. I've got some recommendations for your
blog you might be interested in hearing. Either way, great blog and
I look forward to seeing it develop over time.

Also visit my website; og baller ( Alan - http://emceekerser.com/ )

Greetings! Very helpful advice in this particular post!
It's the little changes that will make the most significant changes.
Thanks for sharing!

Here is my weblog :: accounting company ( www.evernote.com - https://www.evernote.com/shard/s703/sh/673f25b8-19b6-4bbc-9be9-06ad6fbf6... )

Nice 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 stand
out. Please let me know where you got your theme.
Bless you

my page ... dis implanti - http://www.disimplantlari.info

Hi! I undersatand thjs is omewhat off-topic however I nneeded to ask.
Does running a well-established website like yours require a lot of work?
I am brand new to bloging however I do write in my journal on a daily
basis. I'd like tto start a blog so I can easily share myy personal
experience and thougvhts online. Please let me know iff you have anyy kijnd of ideas or tips for new aspiring bloggers.
Appreciate it!

my web-site: Ios Hack - http://lineleadertherapy.com/?option=com_k2&view=itemlist&task=user&id=1...

The researchers had 18 study participants go by means of 3 months of supervised workout instruction, where they worked out aerobically three times
per week - with activities like jogging, walking on a treadmill or pedaling on a stationary
bike - and performed strengthening workout routines when a week.

Feel free to surf to my blog post :: exercise science [ Kaylene - http://wiki.labeli.org/index.php/CVC._Foros ]

What's up, this weekend is nce in support of me, since this
point in tikme i am reading this enormous informative piece off writing
here at my residence.

Here is my webpage: ios games - http://www.professionalontheweb.com/p/w/shilla+wills/207718

I am sure this paragraph has touched all the intdrnet viewers,
its really really pleasant piece of writing onn building uup new blog.

Also visit my web blog: Castle Crees TD Cheats - http://castlecreeps.tribalpages.com/tribe/browse?userid=castlecreeps&vie...

I'll right away clutch your rss as I can't to find your e-mail subscription link or e-newsletter service.
Do you have any? Please let me recognise in order that I could subscribe.
Thanks.

Check out my blog post - longchamp bags cheap - http://mtcare7.dothome.co.kr/?document_srl=176974

Pages

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.