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

We are a group of volunteers and opening a brand new scheme in our community.
Your website provided us with helpful information to work on. You have performed a formidable task and our entire neighborhood can be thankful to
you.

Feel free to visit my web-site: penis - http://www.outdoorcomfortsofhouston.com

It is in reality a nice and helpful piece of information. I'm glad that
you simply shared this helpful info with us. Plerase keep us up to date like this.
Thanks for sharing.

My page; Fire Emblem Heroes hack 2015 mac - http://www.arudealaruba.com/?ad_listing=factors-of-fire-emblem-heroes-ha...

We're a group of volunteers and opening a new scheme in our community.
Your website offered us with valuable information to
work on. You've done an impressive job and our whole community will be grateful to you.

dinero rapido - http://www.cookingforengineers.com/forums/profile.php?mode=viewprofile&u...
http://adbconseil.fr/forum/profile.php?mode=viewprofile&u=1432541
http://badlandscrossfit.blogspot.com/2016/10/prestamos-rapidos-estando-e...
http://www.my-big-toe.com/forums/memberlist.php?mode=viewprofile&u=9888

Sobre las críticas que la oposición ha hecho al Gobierno por no haber garantizado la seguridad de los
espectadores que presenciaban los fuegos artificiales cuando fueron arrollados, Valls negó que
el dispositivo fuera insuficiente y señaló
que fue el mismo que estuvo actual en la Eurocopa en el Carnaval de esa ciudad.

Feel free to visit my site; donde hacer resonancia magnetica
zona norte - http://eleman-design.com/?option=com_k2&view=itemlist&task=user&id=190723

You actually make it appear really easy together with your presentation however I to find
this topic to be actually something that I think I'd never understand.
It kind of feels too complex and extremely broad for me.
I am taking a look ahead to your next post, I will
attempt to get the grasp of it!

Feel free to surf to my webpage; Foot Corns - http://www.deelsonheels.com/Foot_Corn_Bunion_Gel_Cushion_Strips_Pain_Rel...

It's awesome to go to see this web page and reading the views
of all mates regarding this piece of writing, while I am also keen of getting
knowledge.

creditos rapidos con asnef y rai - http://forum.inosmi.ru/member.php?u=165901
http://forums.stickpage.com/member.php?257325-CoordinatedLiquid075
http://f13pc.pt/forum/member.php?u=6664
http://creditos-personales.blogspot.com

What's up everybody, here every person is sharing these kinds of know-how, therefore it's fastidious to read this blog, and I used to visit this web site all
the time.

mini prestamos - http://www.aquarius-dir.com/prestamos-rapidos-online_195268.html
http://andysmie.blogspot.com/
http://paula-gomez-blog.blogspot.com.es/2016/03/creditos-personales-empr...
http://aljanoube.com/member.php?u=6549

Link exchange is nothing else however it is simply placing
the other person's blog link on your page at appropriate place and
other person will also do similar in support of you.

wholesale jerseys - http://truefitnessolutions.com/5-best-tips-to-get-fit-fast

Hi Dear, are you actually visiting this web page daily, if so after that you will definitely get pleasant
experience.

Here is my blog Delores - http://wallinside.com/post-57507363-jamie-lynn-spears-daughter-leaves-ho...

I like what you guys are up too. This sort of clever work and coverage!
Keep up the excellent works guys I've you guys to my blogroll.

Feel free to surf to my blog post Hampson Hughes - http://115.29.234.170/willow/?q=node/8773

So you, as the restorer, have to set realistic goals as to exactly what parts of the car you
are going to restore to their original states and what parts of the car you are willing to restore "as close as possible" to their original states.

The turbo 4-banger in the Volkswagon GTI Mk5 is fairly unique among such engines in that
it produces huge amounts of torque at a relatively low number of RPMs.
Listed here are some interesting facts about Mercedes-Benz.

My website make money blogging - http://howibuildcash.com/top-tier-business/master-sitemap.html

whoah this weblog is great i love studying your posts.

Keep up the good work! You understand, lots of persons are searching
around for this info, you can aid them greatly.

creditos rapidos con asnef y rai - http://www.sota-servis.com.ua/phpBB2/profile.php?mode=viewprofile&u=1470
http://www.pbnation.com/member.php?u=800441
http://board.tapmania.org/member.php?u=7531
http://montani.org/index.php?a=stats&u=miguelinac

Attractive component of content. I just stumbled upon your web site and in accession capital
to say that I acquire actually enjoyed account your weblog
posts. Any way I will be subscribing in your feeds or even I success you access constantly quickly.

creditos rapidos sin aval - http://blankchat.com/index.php?a=profile&u=marnie
http://shuijin12.over-blog.com/2016/05/diez-anuncios-que-nunca-veras-en-...
https://www.torgi.gov.ru/forum/user/profile/126538.page
http://forum.inosmi.ru/member.php?u=173286

You wiⅼl notice that tɦe majority of heг pugs not drugs t shirt mens - Jed -
http://www.worldcitylist.com/ads/user/profile/99610 , Һas changed
colour, but there is nonetheless ѕome red remaining оn the stripes օf her shirt, aroᥙnd the edges and оn her fingernails.

Great goods from you, man. I have remember your stuff previous to and you're simply too excellent.

I really like what you have obtained right here, certainly like what you're stating and the
way social media companies in delhi - http://hungerwiki.org/index.php?title=Social-Media-Advertising-Suggestio... which through which you say it.

You make it entertaining and you still care for to stay it wise.
I can't wait to read far more from you. This is actually a tremendous website.

This is very interesting, You're a very
skilled blogger. I have joined your rss feed and look forward
to seeking more of your magnificent post. Also, I've shared your web site in my social networks!

creditos rapidos online sin aval - http://www.alcoholhulp.be/forum/member.php?2105-crisfer22
http://popyt.com.ua/user/chanazmkxm/
http://www.alswarma.com/profile.php?u=ermagerar
http://www.bluejaysmessageboard.com/members/2008-AbleStatement012

The proceeds of selling your older car can go to the operations of the charity like giving food or
clothing to the family that they supported.
Be smart and savvy when negotiating the interest rate for new
cars and don't just sign on the bottom line. It includes 4 different frequencies so you can race against your friends.

My page :: signage company - http://www.martsigns.co.uk/

You should be a part of a contest for one of the finest websites on the net.
I most certainly will highly recommend this site!

creditos rapidos online asnef - http://www.zonatuning.com/members/almulopez/
http://www.advancedseodirectory.com/health/workplace/
http://www.boss-oil.com/ActivityFeed/MyProfile/tabid/92/UserId/215162/De...
http://forum.html.it/forum/member.php?userid=416962

Hi, I do believe this is an excellent website.

I stumbledupon it ;) I will return once again since I book-marked it.
Money and freedom is the best way to change, may you be rich and continue to help other people.

créditos rápidos urgentes - http://www.donyatv.com/profile.php?u=lottiecroftad
http://clickforu.com/blog/1648465/los-mejores-prestamos-rapidos-del-mes/
https://es.scribd.com/document/337061639/Dispon-Micro-Cre-ditos-Ra-pidos...
http://www.logos.md/forum/member.php?u=1202

Doᥱs уߋur blog havᥱ a contact page?

I'm Һaving trouble locating іt but, ӏ'd
like to shooot you an email. I've got somе suggestions for үour blog you might
be interested іn hearing. Εither աay,
ցreat site aand Ι ⅼook forward tо seeing it improve ⲟveг time.

Feel free to visit mү weblog :: cham soc daa - http://haylamdep.com/

I'd like to find out more? I'd love to find out more details.

cheap jerseys - http://Www.Trendslondon.com/2014/01/22/why-people-are-crazy-about-nfl-ta...

Along with the car sales, the Japanese used car sellers also supply the dismantled parts of the vehicles in cube containers of size 20ft or 40 ft.
Driven aggressively, the cars will run out of power in about 30 minutes.
According to Campbell Fuller, spokesman for the ICA, buyers need to contact their insurer before agreeing to a
purchase.

Here is my blog post; C9 Highlights - https://www.youtube.com/user/KazaLoLLCSHighlights

Today, I went to the beach with my kids. I found valentines day wishes for a son - https://happyvalentinesdaystatus.com/ sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She placed the shell to her ear and screamed.
There was a hermit crab inside and it pinched her ear.
She never wants to go back! LoL I know this is entirely off topic but I
had to tell someone!

The warranties for some branded cars may go up to 3 or 4 years depending on the model.
The turbo 4-banger in the Volkswagon GTI Mk5 is fairly unique among such engines in that it
produces huge amounts of torque at a relatively low number of
RPMs. It is available in two versions of petrol and diesel and has been a very reasonable price.

Feel free to surf to my web blog; oat bran - http://www.oatbran.info/

you are actually a just right webmaster. The website loading velocity
is incredible. It sort of feels that you're doing any unique trick.
Furthermore, The contents are masterwork. you've done a great
process in this matter!

prestamos online - http://gxforevermark.com/comment/html/index.php?page=1&id=90851
http://www.hislibris.com/foro-new/profile.php?mode=viewprofile&u=3000
http://motorradfreunde-muenchweilerev.de/Forum/member.php?action=profile...
http://hoc-ke-toan-may.blogspot.com/2016/10/el-sector-de-los-prestamos-r...

The proceeds of selling your older car can go to the operations of the charity like giving food or clothing to the family that they supported.
Now you will soon forget about key-fobs as well since new biometric revolution is going to allow you to
enter your car with your fingerprint, face detection or eyeball recognition. The damage varies from vehicle to vehicle but can be as small as light hail damage which
is barely visible through to damage caused by falling trees.

Feel free to surf to my blog post :: toronto contest prep
coach - http://www.buildmybodybeautiful.com/

I'll right away snatch your rss as I can not find your
e-mail subscription hyperlink or e-newsletter service.
Do you have any? Kindly allow me recognise in order that I may
subscribe. Thanks.

Check out my web page: xem them - http://interconphuquoc.vn/mo-ban-toa-ct2b-chung-cu-gelexia-riverside.html

Truly no matter if someone doesn't understand afterward its up to other viewers that
they will assist, so here it happens.

Feel free to visit my homepage: hotlink red 2017 - http://hotlinkred.weebly.com/

You can also have the train that the creature
ride on within the TV series. For example, fur boots present the perfect
mixture of functionality and fun. It is fun for the mother to determine that
her youngsters are being unified to produce something possible more than anything else if it is on her.

Visit my web page - revenue moel - https://www.valentinesgift.net/

Costs there can be as minimal as $500 for your automobile
in a excellent situation. Driven aggressively, the cars will run out of power in about 30
minutes. Access Free Online Maps via Wi
- Fi or 3G network, such as Google Map.

Here is my blog post: Best way to make money online from
home in 2017 - https://www.youtube.com/watch?v=fhBDQAfF4nQ

I’m not that much of a internet reader to be honest
but your sites really nice, keep it up! I'll go ahead and bookmark your site to come back down the road.
Many thanks
cheap MLB jerseys - http://www.centrolux.at/miniwindowsxs/

Pois se você ainda não teve a possibilidade de se dedicar a uma das formas mas divertidas de praticar futebol,
aproveite esta maré e também comece a praticar Soccer Stars.

Look at my blog post - Jogos online 3D ( http://gameculture.co.uk/ - http://gameculture.co.uk/members/margiestanford/activity/131689/ )

Useful info. Lucky me I found your website unintentionally, and I'm
surprised why this twist Side of Foot Pain - http://www.deelsonheels.com/Bunion_Gel_Cushion_Sleeve_Protectors_Side_of... fate didn't came about earlier!

I bookmarked it.

If you desire to increase your knowledge just keep visiting this site and be updated
with the hottest gossip posted here.
cheap NFL jerseys - http://Sinwald.de/bonrepos-auf-aussonnelle-bonrepos-nimmt-rateau/

Hmm it looks like your blog ate my first comment (it was extremely long)
so I guess I'll just sum it up what I had written and say, I'm thoroughly enjoying your blog.
I too am an aspiring blog writer but I'm still new to everything.
Do you have any suggestions for first-time blog writers?
I'd definitely appreciate it.

Here is my blog Toe Spreaders - http://www.deelsonheels.com/Bunion_Toe_Spreaders_Protector_Hallux_Valgus...

I pay a quick visit everyday some web pages and sites to read articles or reviews,
however this webpage gives quality based content.

creditos rapidos sin papeles - http://mp300.informe.com/profile103130.html
http://forum.diversesolutions.com/members/2883-aliciagzl
https://roosterteeth.com/almulopez22
http://chivascampeon.informe.com/profile56229.html

you're in reality a just right webmaster. The web site loading velocity is amazing.
It kind of feels that you're doing any distinctive trick.
In addition, The contents are masterpiece. you have performed a great task on this matter!

creditos con asnef - http://www.washblog.com/story/2014/1/25/04942/5838
http://hormonesupplement.blogspot.com/
http://www.worldcopper.cn/comment/html/index.php?page=1&id=23659
http://www.impactante.tv/profile.php?u=ermagerar

Everything typed was actually very reasonable. However, what about
this? what if you were to write a killer headline? I mean, I don't want to tell you how to run your
blog, however suppose you added a post title to possibly grab folk's attention? I mean Afegeix un nou comentari | gerdsLAB is kinda boring.
You ought to glance at Yahoo's home page and note how they write news titles to grab people to
click. You might add a video or a related picture or two to
grab people interested about everything've got to say.
Just my opinion, it could bring your website a little bit more interesting.

créditos rápidos faciles - http://telmokist.weebly.com/blog/saber-cuando-y-como-tramitar-un-prestamo

http://simpletowngirl.tumblr.com/post/73213018472/el-interes-de-los-pres...
http://paugom.exteen.com/profile
http://creditosrapidos.bloggets.net/crditos-rpidos-desde-los-cajeros/
http://scoophot.com/cansinopollo9765
http://amostviolentyear-stream.blogspot.com/2017/01/creditos-rapidos-par...

Paragraph writing iis alseo a fun, iff you be acquainted with afterward youu can wdite or else
it is complex to write.

Also visit my blog ... Fire Emblem Heroes Free android hack - http://educationlinks.com.bh/?option=com_k2&view=itemlist&task=user&id=9...

Helpful information. Lucky me I discovered your
web site unintentionally, and I am shocked why this coincidence didn't happened in advance!

I bookmarked it.

Review my blog post - Shoe Lifts - http://www.deelsonheels.com/$1799__Silicone_Shoe_Lifts__Free_Delivery/p133745_317467.aspx

Wow, marvelous blog layout! How long have you been blogging for?
you make blogging look easy. The overall look of your site is magnificent,
as well as the content!

creditos rapidos con nomina - http://www.hosthumor.com/profile.php?u=lottiecroftad
http://giadinhnazarethvietnam.com/video/profile.php?u=kristeenreauai
http://sitesgb.info/tyglahar/forum/profile.php?mode=viewprofile&u=31523
http://www.hauntingmelissa.com/community/member.php?12926-aliciagzl

A new technology introduced by one of the
biggest automobile companies, Volvo, will ensure that your car avoid accidents on the roads involving pedestrians.
Producing a very light car will drop its fuel consumption, and oil companies will not appreciate this.
It is available in two versions of petrol and diesel and has been a very reasonable
price.

Here is my weblog: lotto predictions - https://www.facebook.com/LottoPredictionSystem/

GPU de notebook ou GPU onboard raramente atinge mais de 75°C, pois resto da
placa-mãe não é feita para suportar altas temperaturas, por isso que um processador se desliga quando atinge em torno de 70°C.

Feel free to visit my blog post notebook acer americanas -
http://www.graphic-ali.com/?option=com_k2&view=itemlist&task=user&id=985624

Touche. Great arguments. Keep up the good effort.

Feel free to visit my blog :: Lord Grabiner - http://lordgrabiner.co.uk

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.