MIT App Inventor for Arduino
Introduction
Building an Android application is one option to control your robot project or anything that comes to your mind. And with the use of the MIT App Inventor 2, you can easily create an Android application.
In this tutorial, we will learn to create a simple Android application which can control the state of the LED connected to Arduino Uno board. Bluetooth communication protocol will be use via HC-06 bluetooth module.
In the Arduino Uno, we will create a circuit according to the following diagram:
Source Code
1
2#include "SoftwareSerial.h"
3
4#define LED_PIN 13
5#define HC06_RX 2
6#define HC06_TX 3
7
8SoftwareSerial HC06(HC06_RX,HC06_TX);
9
10bool LED_STATE = false;
11String cmd = "";
12
13void setup() {
14 // put your setup code here, to run once:
15 HC06.begin(9600);
16 pinMode(LED_PIN, OUTPUT);
17 digitalWrite(LED_PIN, LED_STATE);
18}
19
20void loop() {
21 // put your main code here, to run repeatedly:
22 while(HC06.available()>0){
23 cmd+=(char)HC06.read();
24 }
25
26 if(cmd!=""){
27 cmd.trim(); // Remove added LF in transmit
28 // We expect Command from bluetooth
29 if (cmd.equals("1")) {
30 LED_STATE = true;
31 } else if (cmd.equals("0")) {
32 LED_STATE = false;
33 }
34
35 cmd=""; //reset cmd
36 }
37
38 digitalWrite(LED_PIN, LED_STATE);
39}
MIT App Inventor
Follow the following sketch for the MIT App Inventor.
You may download the Android application here: DOWNLOAD THE ANDROID APP
Video Demonstration
Part 1:
Part 2:
Call To Action
I hope I am able to impart a little information to you, but if you have any question, please do not hesitate to leave your question in the comment box. Thank you and have a good day. Happy tinkering.
Posts in this series
- How to Get Started with ATTiny85 in Arduino IDE
- Tutorial: How to use MFRC522 RFID module using Arduino
- SOS Flasher Using Millis Function with Enable Switch
- Tutorial: How to use DS3231 RTC in Arduino
- Tutorial: How to use 0.96 OLED - a small and cute display
- Tutorial: Getting Started with the NRF24L01 | How to use | Arduino
- Tutorial: How to use SIM800L GSM Module for Controlling Anything | Arduino
- Tutorial: How to use Keypad | Text Entry Mode | Arduino
- Tutorial: How to use 4x4 Keypad | Arduino
- Project Idea: Arduino Voltmeter
- Project Idea: Door Lock Security | Arduino
- Multitasking with Arduino | Relay Timer Controller | using millis
- Tutorial Understanding Blink Without Delay | How to millis
- Arduino Simple LCD Menu
- How to use SIM800L GSM Module using Arduino | Make or Answer Voice Calls
- Tutorial: How to Use Arduino Uno as HID | Part 2: Arduino Mouse Emulation
- Tutorial: How to Use Arduino Uno as HID | Part 1: Arduino Keyboard Emulation
- Tutorial: How to use SIM800L DTMF to Control Anything | Arduino
- Tutorial: Arduino EEPROM
- How to use SIM800L GSM Module | Arduino | Send and Receive SMS
- 16x2 LCD Menu for Arduino
- Tutorial: Arduino GPIO | How to use Arduino Pins
- RC Car using L298N, HC-06, and Arduino Uno
- How to Use LCD Keypad Shield for Arduino
- How to Use Arduino Interrupts
- Project: Automatic Alcohol Dispenser
- TUTORIAL: How to use HC-SR04 Ultrasonic Sensor with Arduino
- Source Code: Astronomia Meme and Funeral Dance | melodies the Arduino way
- How to Get Started with L293D Motor Driver Shield with Arduino
- How to Get Started with L298N Motor Driver module using Arduino
- Part 2: Wav Music Player with Lyrics Using Arduino and SD Card
- Interfacing Infrared to Arduino Uno
- Part 1: Wav Music Player Using Arduino Uno and SD Card
- How to Interface Stepper Motor to Arduino Uno
- How To Play MP3 Files on Arduino from SD Card
- What is Arduino Software Serial
- How to Interface SD card to Arduino (without SD card shield)?
- Playing Melodies Using Arduino
- 8 Degrees Of Freedom (DOF) Robot Using Arduino Uno
- How to Interface PS2 Controller to Arduino Uno
- Part 3: DF Player Mini Tinkering with Arduino Nano and LCD
- How to Interface HC-06 to Arduino
- How to make a Remote Control RC car using Arduino and HC-06 bluetooth module
- Part 2: DF Player Mini Tinkering with Arduino Nano
- Part 1: DF Player Mini - a mini cheap mp3 player
No comments yet!