Android Apps for Arduino with MIT App Inventor without Code | Achraf Mad | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Android Apps for Arduino with MIT App Inventor without Code

teacher avatar Achraf Mad, Creative Engineer

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

26 Lessons (3h 30m)
    • 1. 1 Introduction

      3:20
    • 2. 2 App Inverntor Overview

      4:12
    • 3. 3 An App Challenge

      1:04
    • 4. 4 System Requirements

      1:14
    • 5. 5 What is App Inventor

      2:19
    • 6. 6 AppInventor Vs Java and C

      2:58
    • 7. 7 Why App Inventor Works

      1:39
    • 8. 8 App Architecture

      5:17
    • 9. 9 Download and Install App Inventor on Your Device

      8:32
    • 10. 10 AppInventor UserInterface With Example

      13:44
    • 11. 11 Arduino Coding for Led On Off Practical Example

      8:28
    • 12. 12 Making an Android App for Led On Off Practical Example

      12:26
    • 13. 13 Testing On Off App with Arduino

      6:40
    • 14. 14 Make a Log In Protected Led Control App

      14:03
    • 15. 15 Slider Application to Control Led Brightness

      14:30
    • 16. 16 Slider Practical

      9:21
    • 17. 16a Practical Connect Bluetooth Module

      4:43
    • 18. 18 RGB Led Controller Android Application

      14:05
    • 19. 19 RGB LED Arduino Coding

      12:03
    • 20. 22 Sensor Readings Android Application

      16:51
    • 21. 24 Relay On Off Simple Example

      7:51
    • 22. 25 LCD Text Arduino Coding

      9:20
    • 23. 26 LCD Text Android Application

      6:27
    • 24. 28 Remote Controlled Robot Android Application

      9:07
    • 25. 29 Remote Controlled Robot Arduino Coding

      14:41
    • 26. 30 Make Money with MIT App Inventor Apps

      5:11
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

3

Students

--

Projects

About This Class

Android Apps for Arduino with MIT App Inventor without Code If you have been thinking about turning your Arduino into a more capable device for long but have been avoiding learning programming, then you are not alone. In this course, we will show you how to build an Android app for Arduino without any prior coding

Welcome to this course:

Android Apps for Arduino with MIT App Inventor without Coding is a practical course in which you’re going to build More than 8 Android applications to interact with the Arduino.

Why you should take this course?

  • Lessons for Android apps

  • Build cool Android applications for Arduino

  • No coding experience required

  • This course is a step-by-step course to help you build an Android app for your Arduino, without any prior coding experience.

  • You'll learn how to create animated sprites and objects, add sound effects and music, control player movement, and program in simple scripts.

You Will Get:

  • Step-by-step instructions for building the app design and logic,

  • Downloadable code and schematics,

  • .aia files (files that you can use with MIT App Inventor 2 software to edit the app),

  • .apk files (files that you can run on your smartphone).

What you will build?

  • LED ON-OFF Controller (Bluetooth).

  • Login Protected LED ON-OFF Controller.

  • LED Slider (Bluetooth).

  • RGB LED Controller (Bluetooth).

  • Temperature Sensing Application.

  • Relay On-Off Control.

  • LCD Display Text Control.

  • Remote Controlled DC Motors (Robot Basics).

Meet Your Teacher

Teacher Profile Image

Achraf Mad

Creative Engineer

Teacher

Hello, I'm Achraf.

A passionate engineer who loves to share his knowledge with the world

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. 1 Introduction: Hello and welcome to this new course in which I'm going to teach you how to make unthreaded apps for Arduino with an IT App Inventor without writing a single chord. And this is Ashraf from educational engineering team. In this course, you will learn in a step-by-step manner how to get Android apps and build cool applications for Arduino, even with no prior experience at all. Now, things that will be included with this course. This course is a practical course in which you are going to build more than eight Android applications to interact with Arduino. Each project will contain step-by-step instructions for building the app design on logic. We will also attach downloadable schematics and colds. That APK file for each of the Arabs will also be available for you to download. And now let's dig in to what you will learn in this course. First, we will talk about App Inventor. What is App inventor? And how this top up inventory and your machine. Then we will cover event driven programming and components and properties inside App Inventor. This will be a quick introduction to App Inventor, the user interface, how to deal with it, how to sit up up in winter. The latest version on your device for free, plus other applications that we might need for this course. After doing that, we will move on to the next part of our course. First, we'll create an Android app that will turn on LED on and off. Then we'll move on to logan. Oh, look in protected lead controller. And we will build a slider That's controls valid brightness. After that, we will control the color of an RGB LED using our color picker from our Android app, will create another app to read that temperature from a temperature sensor and display the value on the up. After that, we will build an Android app that controls alarm connected to hourly or any other device. We will end with. Build. An Android app that allows you to life messages and send them to the Arduino to be displayed will say on an LCD, you can even send a message to turn it on, I let off, etc. Other applications will be added to this course each month. So stay tuned for the updates. And we will get started with eight Android applications. I'm sure that you will enjoy this course. It's purely practical course, so you will not get pooled and you will come with results in no time. Again, no programming experience is required. This is Ashraf. See you inside. 2. 2 App Inverntor Overview: Hello and welcome to the Tsinghua song in which we are going to talk about what is AP inventive. App inventory is a visual blocks language for programming mobile apps. You can easily create an Android apps, interactive Android apps, and upload them to the Play Store so that anyone can use these apps to control and revise all to do basic mathematics and solving equations or any other task that you have in mind. Now, what's amazing about this platform is it's totally free. App inventory is a free web-based program for creating applications for Android devices. App inventory is an easy way to introduce programming to young students. I've inventory is also fun for students and teachers because they can demonstrate their creativity to others. Goebel created this language and gave it to MIT, where it has been improved. Now, we already mentioned that App Inventor's is basically, I'm Brooke language platform like plugging in puzzle pieces, similar to Lego, Mindstorms and scratch, but for phones on the robots. Hypercard for mobile phones, electronic napkin for prototyping, abs, and also demo app building. Now, the main features of App Inventor are it is easy for us to create Hopi apps for Android smartphones, visually fitting together puzzle piece, shaved programming blocks. It's also web based. Basically, it started on the first quarter of 2020. Mit Center for more pile learning launched App in winter service for general public axis. Now, why it is so easy to use App Inventor, there is no syntax that blocks language eliminates the need to remember and type code. Everything is right in front of you. Components and functions are in drawers. Just fine. Drag and drop the component that you want. It's also events at top level. When this happens, the app does this. It's very straightforward. This is the correct conceptual model. So you don't need to worry about what will happen if an action took place. It also has highly event components. The App Inventor's team has built a great library with simplicity. The main goal, only some blocks plugin. You can't do things that don't make sense. So blocks will help you make sense out of your Android application. There is also another feature that is a very important feature, which is concreteness, which means less abstract than money languages. I'm sure that you will enjoy creating Apps with App Inventor's. But what you can build with AP inventory, well, basically everything. You can build educational apps, including video, images, text to speech. You can't build location. Our apps, you can build games. And x t are both controllers, would enabled Arabs personal apps. And we are going to build apps that control Arduino microcontroller. Now this was a quick introduction. Inventory. Thanks for watching this lesson. See you on it. 3. 3 An App Challenge: Hello and welcome to this new lesson in which we are going to get started with the practical stuff. Now, as you can see, that this is an image for an app inventory Android application. Now, pause this video and give yourself some time to think about to what this app is going to accomplish or what's this lab is for. Now, this is an app inventory AB, and this is the blocking structure. Try to read between the lines and see if you can figure out what is the output of this app. And what do you think this AB does? I'll wait for your response in the Q and a section. Now, once you have an answer, you can move on to the next lesson. Try to make, I guess, even if clause a wild guess. Thanks for watching this lesson. See you on it. 4. 4 System Requirements: Now let's talk about that system requirements for running App Inventor. You will need an Internet Explorer, Mozilla, Firefox, Apple's Safari, or Chrome, or even Microsoft Edge or Microsoft Internet Explorer. Now, we usually recommend running the latest version, but if you have an old version, it will work. You will also need at least Java variance X. Now, you can run this MIT App Inventory on Macintosh with Intel processor or Windows device or a Linux device, you will need one gigabyte of RAM and at least half gigabytes of hard disk space. Now this will be for the offline version. Now the recommended is two gigabytes flam and 200 bytes of hard disk space. Now these are the basic requirements. Make sure that you have at least one of these operating systems. Before moving on. That's crossing this lesson. See you. 5. 5 What is App Inventor: Hello and welcome to this new lesson in which we are going to talk about through what is AP and ventral. Now, app inventory lets you develop applications for Android phones using our web browser and either are connected form or emulator. Now, as you can see here, the App Inventor serovars store your work and help you keep track fuel projects. So here is our Arab inventory sale for. And this is the user interface in which you will drag and drop icons to your Android application user interface. This is called app. And when port designer, it will be controlled using App Inventor's block editor. And as you can see here, we have blocks like the ones we have previously mentioned. Now, after writing or adding the blocks, drawing the user interface, you can run the application to test it out using an Android emulator or an Android phone. And you are going to explain all of this in the practical section. Now, what is it? You build apps by working with the app inventor designer, which is this, were you select the components for your app. The app inventor blocks editor, which is this one, where you ask simple program blocks that specify how the components should behave. After doing that, your app appears on the form step-by-step as you add pieces, toilets so you can test your work. As you build. You will see an emulator that shows you everything. When you are done, you can package your app and produce a standalone application to uninstall. If you don't have an Android phone, you can build your apps using the Android emulator. Android emulator is basically a software that runs on your computer and behave just like the fall. Now. And the next lesson, we are going to compare between Java and App Inventor facts law. So in this lesson, this is Ashraf. 6. 6 AppInventor Vs Java and C: Hello and welcome to this new lesson in which we are going to talk about that difference between Java and App Inventor. Now to the left you can see a Java called, which is public class HelloWorld AB. And here we have the main method which is public static, void main, and this pool print hello earth. Now, this is a Java code. This is the App Inventor cold, which basically will execute the printing command of helloworld, which is ethics, as you can see here. Once our button is clicked on our app, we haven't applied any over these things. We just dug, drop, drop, drop, drop, drop. And you have a fully functional Android app that will display hello world and our text. Once I use are clicks a button. Now, as you can see, here is another example. This is the system without the print hello world. And this is a button that shows a message box which will show HelloWorld. So these two ways are basically, are we to print out hello world on accessibly. This is how you can do the same thing using programming blocks in App Inventor. Now, as you can see, here we have button send double-click. Once you click the button, which is basically the on button here, these four applications, it will display hello world on the label. So you can see then Assyria disregulate. Now, as you can see, the same code using three lines of code is a little bit difficult for new comers aren't not very experienced programmers. While the bloke methods, it's just a matter of dragging and dropping blocks. Now, can you guess what these blocks do? As you can see, we have bowl untouched. Now when undue are things that you need to keep in mind. And as you can see, we have variables, we have methods, and we have global variables. We have Canvas. So give yourself some time to see if you can figure out what this, these blocks do. Now if you didn't know, it's okay because we haven't learned anything yet. Try out. And if you succeed, post your answer in the Q and a or in the comments of this lecture so that we can see if your answer is correct. Thanks for watching this lesson. See you next. 7. 7 Why App Inventor Works: Hello and welcome to this new lesson in which we are going to talk about the architecture of App Inventor. Now, before moving to this point, Let's talk about why App Inventor works. First, there is no typing of code and no syntax errors. This is a very difficult job for people who are not experienced programmers. Programmers get syntax all the time. They get tired of writing codes over and over again. This is replaced with blocks. Now, this language also depend on events. So events is the very first level of information that you need to deal with, like putting together a puzzle. Only some pieces fit. So you'll find that some things are allowed, others are not. And you will learn as we go, what are the things that are allowed and what are the things that you cannot do in this platform. It's also highly, we'll logo, we'll team has put a lot of work in it. And it's concrete because it has less abstract. There is no Husserl and you can get your app up and running in less than ten minutes. Now. This is why up in winter works. In the next lecture we are going to talk about the architecture of AP inventory apps. Thanks for watching. See you next. 8. 8 App Architecture: Hello and welcome to this new lesson in which we're going to explain the AP architecture of that up inventory application. Now, as you can see here, we have the app and the four main components here, all of the components, variables, behaviors, which is event handlers and procedures. Now the components that are visible components like buttons, text boxes, labels, and there are none visible components like texting, location, since all text to speech and other things. Now variables, Everyone's familiar with variables that are basically containers that has that you can use to store data and you can use to read data from. Now. Their behavior, there are event and response. Event is like our button click texting. And if a message is received, the response is, let's say you will move up all. If you are making, again, you are sending a text, you are sending a message, or you are sitting a label or your heart, you are hiding or showing a specific label depending on the event. So an event happen, it will cause a response. And you can't control what event will proceed from. Let's say, a mouse click a button, click a message, a text, or any move on your app. Now we'll talk about these in more details in the practical section. But lists are talking about the Kim bonus. Basically the components are objects or elements used to create an application. And basically they show on the user interface well into. The second main component is that events. Computer programming, event-driven programming, or event-based programming, is a programming paradigm in which the flow of the program is determined by events. For example, since all outputs or use our actions like mouse clicks, key presses, all messages from other programs, all threads. As you can see here are some examples. The event type is our user initiated event. When the user clicks a button a, do the following. Now, they'll also initialization events when the Arab lunches do something Sibley image or show him a logo. There is also time on events like 120 milliseconds passes due the following change the background color. Now there are also external events when the foreign receives a text, do read the text or display it on a label. So this is basically the events. Now, the events handler, which is the functions performed in response to an event. When an event happens, the corresponding event handler is invoked and the response is displaying a text, moving something on the Sibley. Every component has a cell of built in functions that happens in some events. For example, the button component has adult click event handler. This built-in function called event handlers are programmable, meaning that programmers put the instruction they want to be executed when the corresponding event happens. In other words, Program, I'll state the reactive behavior the Arab should say to that corresponding events. Now, that behavior, it defines how the ARB should respond to the events. Both user initiated Like button click and external, like an ass, I'm asked texts arrives to the phone. All of these together and form your Android application that can run on an Android device and can easily do things you couldn't imagine without even writing a single line of code. So the r components and the user interface, it visible and non-visible. There are events, an event handler. Now the event is the action and the event handler is the, let's say, the function that takes control after an event happens, like a button click. Let's say time passes a certain amount of seconds, etc. That's it. I hope that's you now understand the structure of the app and Android on MIT App Inventory. Next, we are going to uninstall the platform on our device. Thanks for watching this lesson. This is Ashraf. 9. 9 Download and Install App Inventor on Your Device: Hello and welcome to this new lesson in OCR going to explain how to install MIT App and when Thor on your device. Now, the first step is going to any search engine like Google. Now in here, right, MIT inventory. And once you write MIT App infinite or download, you will be directed toward installing App Inventor to on Windows. Now this is the user interface or the whole page that we will use to uninstall MIT App inventory on our Windows device. And these are the instructions. Now, as you can see, installing the app Inventor Setup software package. This tip is the same for all Android devices and for all operating systems. Now, the first thing that we need to do is download the installer by clicking here. Now as you can see, it's about 80 megabytes. And to take some time to download. Once you download it, you need to run the installer file, which is adult EXE file, and simply click Next Next, Next. Now, in most cases, up inventory should be able to locate the setup software on its own. But if it asks for the location of the software, you can use this path. As you can see, pull Program Files, app inventory commands for AP inventory. Now, if you are using 64 bit machine, you might need to use the program files x 86 instead of just Program Files right here. But you and most likely pass this tip as up inventory will auto detect the software. Now. You will wait for this software to finish. And once you are done installing, you'll need to sit up that emulator. Or you can connect your Android phone via USB. Since most people have iPhone and all sum of people have iPhone and others have unrolled forms. We will assume that no one has a phone, which will be easier and we will use the emulator. So the next step is set up that emulator. Click here. And you will be directed, as you can see here, to the emulator setup. As you can see, this is in your router setup for Windows and Linux only. Now for Mac users, there is another tutorial and as you can see, you can go to the Mac sodium by clicking here. Now, we will let that MIT App Inventory software setup finish. Then we will talk about that emulator. Now that we have the download finished, just click once, and thus it hub will begin. This is the setup window and just click Next. I agree. Anyone Next choose to enable the desktop icon click next. And this is the directory, because I'm using a 64 bit machine. We have X86 here and click Next. Install. As you can see now, it's installing IT App Inventor tools version 2.3. And they are updating these tools on monthly basis. Now click Next and Finish. It will start, AI starts or tool. Now, as you can see, MIT App Inventor's tools has been previously installed for all users. Please restore the install R with administrate or privileges. Click OK. Go back to the start menu, right-click the AI starts her. Click More and click Run as administrator. Click Yes. Now as you can see, epsilon. Now if you see this window, it means that MIT App and visual tools are up and running and they are waiting for you to start using our platform. Now, after doing this, what we're to do is go back to the Edge browser. Here. Close this window. And as you can see, we have done everything. Now comes the very important step which is opening up the platform. You need thrive the following. Here, i2. Dots app in winter, mit.edu. Again, the i2 up inventory, mit.edu. Click enter. And you will see that App Inventor's were blood for now to login to the app inventory platform, you will need a Gmail account. If you don't have one, you can simply click Create an account. Let me show this to English. You can simply click Create an account. And you can start by filling your information, name, last name, their username for your e-mail, that password and you can confirm your password. It's a very simple and easy process. And almost everyone has a Gmail account, so click sign in and sign in with your Gmail account. Now, as you can see, I have two-step verification enabled, so I have to grab my phone and enable the sign-in process so that we can sign in to the MIT App Inventory. Now, I have approved this sine n. As you can see. Now, we are inside MIT App inventor and you just need to click, I accept the Terms of Service. Now once you are here, you will see that there is a welcome message. And as you can see, these are the blocks that you are going to, to use. And this includes our new Almighty up inventory gallery. They have annual gallery with a little new components. Now, you can't sit up and connect an Android device by clicking here. You can click here if you don't want to see this message again and click Continue. Now again, this is get started with some tutorials message. You can't simply close it. And this is the user interface. Now if you want to create a new project, simply click Start new project. Let's name it. We already mentioned that the first project that we are going to make is that that term's a lid on, lid on and off. So let's number our lids on, off. And That's it. Now click Okay. And this is your first project. Now you can start dragging and dropping items here. But we want exhibit I think in this lesson, we will explain those aren't affairs in the next lesson. That's it for this lesson. If you have unequal, please ask in that line, the airport. And this is Ashraf. 10. 10 AppInventor UserInterface With Example: Hello and welcome to this new lesson in which we are going to Sibley end up inventory user interface. Now before getting started with App Inventory, you need to understand that there are three main parts. There is the designer, which is the place where assets are combined. There is the block editor and basically the editorial is where you till things, what to do. And to access that look, you need to click blocks right here. And here you can drag the blocks from here to this white area. Now if you want to go back to the designers, were the designer is, you just need to click Designer. Now, the third part is zap, that emulator, which is a varchar mobile device. Or you can connect your own mobile device. Now to accident that emulator, you need to simply click Connect immunity. Now, as you can see, starting the Android emulator, please wait. This might take a minute or two. Now, as you can see here in the background, that emulator is starting. Now if you followed the previous lesson steps to download and install IT UP inventory, you'll have the installer up and running. Now this is basically a small Android device that you will use to test things out. As you can see, now it's running and it's sweating for about 20 seconds to make sure that everything is working just fine. This is the Android emulator built n with that MIT App inventor. Now, if you don't want the emulator, you can simply close it by clicking here. Now your component AB is out of date. Click Okay to start on the Update. Watch your emulator screen because you will be asked to approve the update click. Okay. Now going back, as you can see to the emulator, you need to click OK to approve the Update. And click Install. Now click Open. Now click Okay to replace the Arab with the new version and click Install again. My take a minute to download and install MIT AI to companion or AP and Renton inventory to container. Now click Open. As you can see, it's finishing Dennis solution process. Now running using the emulator or grass P waiting to get blocks. If you did see this screen means that everything, Okay. Now click Got it, and that's it. These are the three main components. Now, before starting with the lid on, off, let's create a new project and let's call it Hello up or HelloWorld. Now this is the Hello World application in which we are going to practice few things. Now, how do you get started? Now list-style by adding a label and a label. If you clicked here, this ablaze, a piece of text which is specified through that text property. Other properties, all of which can be set in the designer or a block editor. You can't control their periods and placement of that x. Simply drag an image up here and drag a label beneath it. So now we have an image and we have a label on our app. Now let's save that, this text. We need something and gills. Now it's tasteful, liberal ones. So you can go here in the Properties window and change it with HelloWorld. Now the text is very small. To increase the font size, you can't replace it here with, let's say thirsty. And now, as you can see, it's readable. You can add a background color for the text. Let's say red. All, let's make it pink. Now, you can also change the text color. If you are in down here, you can see that here we have a text color option. You can't change it to gray or to something that you can't read. It. So now we have a text. We added a background color or text color. And you can even change the font type and the font size. Now you can make it bold as well. So all of those qualities are here. Now, if you clicked on the image, you can see that you can control the height, the width, and you can load a picture on this item. So rather big child, simply click Upload File. And now you need to choose the file or choose a file from your device. So to choose a file, simply click here. Now let's say that we want this image Double-click and click OK. It will upload the image to up and Wintel, as you can see now, it's here. And as you can see, it's a very huge image. And it took all talk, almost everything on our device screen. So we need to control the width and height. You can either click fill parent, or you can choose a percentage. You can choose the width to be a 100 percent and the height to be either fill parent. As you can see it now we can't see the full image and the text. Or you can change person two. And let's say 50 percent. So it will take 50 percent of the whole display, as you can see here, and is taking a 100%. You can't reduce this to 40 percent. And now it looks more convenient. Now, the next step is aligning the text. If you want to align the text, you can't go to text alignment and make it center. As you can see now, the text is centered inside this area. Now, you can also control the height and width of the text. Now, once you have all of this, you can also add a button underneath that text box. And let's say that we want to play a sound when this button is pressed. It will be a very simple process. Simply change the button name to play sound. As you can see now, the baton name is changed, changed the font size to thirsty. And you can't show the font. You can even change the shape to rounded or rectangular or oval. So let's keep it around it. Now. As you can see, it's centered so that text is in the center of the button itself. And you can control the height, width, and you can even add an image for that button. Now, once you are done here, you can go to the blocks menu. And when you are inside that block S1, you can see that we have Screen1, which is the first screen that we have created. Screen1, it has image label button, and these are the three components. You will see the very same thing here, Screen1, image, label button. Now consider this our programming area. Now if you click the button, you will see a little blocks that you can drag for this bottle. Now, the most common one is when the button is clicked. Now when that button is clicked, we need to do things which are called procedures. As you can see here, we have a lot of procedures. You can call a procedure. You can create a variable. You can, let's say color something. You can call the dictionary used. You can add lists. You cannot texts, last, logic and control. Now. Now let's say that you want to play a sound when the button is clicked. In order to be a sound, we must first have that sound. So going back to the designer and scroll to the media section right here, and n here, simply click sound that I get. And Robert here. Now as you can see, the sound is added but it's not visible and you can't control it from here. Click sound. And in here, you can click choose the source of this sound. Now, you need to upload a sound from your device. You can download a sound from anywhere online. Now this is an example upside with Dash sounds that come. You can't play the sound and you can't simply download. Now, you can pick any of these towns and download it. And once you download it, you will have an Add. Now this is a good word file. You can't sin B, Save As, and save it to the downloads folder. So I click Save. Now going back to the unlike the App Inventor, click Upload File, click Choose File, and simply select the WAV file. And I'll click Okay. Now we have email 01, that wave. We can go back to the blocks. And here we have the sound. We can't simply call sound the way. Now, when a user clicks, it will call sound play. And that's it. This is our code. So let's go back to the designer and click build. You can build an APK file or save it to your computer. If you wanted this, this AB, you can click Connect emulator. Now, as you can see, this is our emulator. And as usual, take some time to start responding. So this is r. And the emulator. As you can see, the image that takes on the bottom, simply click play sound. And it will play the sound in the back that out. That's it. This is your very first lab. You add an image and text on the button and you play the sound. You can test this app using Android device and it will work like a charm. So we have created an app without even writing a single chord. Now, in the coming lessons, we are going to start creating the very first practical application to control and turn it on and off. That's it for this lesson. Thanks, washing. This is Ashley. 11. 11 Arduino Coding for Led On Off Practical Example: Hello and welcome to this new lesson notes I'm going to explain how you can easily control eyelid using MIT App Inventory. Now, in this lesson, we are going to start by creating all by coding or Arduino board to receive that control commands from our Android application. So let's go and open up Arduino software. Now create a new file. And here we have all new file. First, we need to initialize that variable and which we are going to solo the incoming data. Let's call it incoming value. And let's give it an initial value of 0. Now inside the setup, we need to initialize the serial communication. Because the Bluetooth module is going to use cURL communication to interact with the Android application. So we are going to use Bluetooth. And Bluetooth is usually all is serial communication. So y, again, at a baud rate 9,600. And we need to control LET number on pin number 13, which is the interior not live. So pinMode, all the sludge will be output. Sorry, 13 outflow. Now. And this is the width you. And inside the loop we're going to write a code that will check if they're a serial communication. All of those incoming data on the serial line or not. We will start with IF statement. And inside this, if certainty will ask if Serial available is above 0. And if it is, it means that there is incoming data on the serial line. Now in this case, we need to read the incoming data using the serial 23 IT function. Now the SR literally function will read the incoming data and store it inside the incoming value, which is this variable. After that, we will print it out on the serial monitor to make sure that you are receiving data. And let's add a new line. After we print it out. Now, after that, we need to ask if the incoming data equals a specific thing. So if incoming value equals one. And in the next lesson, when creating our Android application, we are going to assign the R button that says On to send one via Bluetooth. And the button that says off, we will make it send 0 via Bluetooth, Alec sibilant in a minute. Now, if we received one and then digital lives, we need to turn on the LED on pin number 13. Now, if the incoming value equals 0, then we will turn it off. 13. Law. That's it now. And this is the code that you need to control. Our lead first were created anew variable. We call this variable incoming value. To store the incoming data, we initialize the Sierra communication. We assign pin number 13 and made it output. Now, if they're Sierra communication, then read the incoming data using the sera. Literally it store it here, 28 on the serial monitor. After that, if the incoming data that we did, the reads equals 1, then turn on the eyelid on pin number 13. If it equals 0, then turn off this lid on pin number 13. That's it. This is how easy it is from the Arduino side. Now, let me explain what happens here. Well, what will happen on our Android application? Now, to make things clear, we have, we will create an Android application that looks like this. It will have two, will have two buttons. This one is on and this one is off. Now, when the button is clicked. Now this is connected to the Arduino using the tools. Now, if we let the on button, it will send one via Bluetooth to the Arduino. And Arduino received one, it will turn on lid on pin number 13. Now if we clicked off, it will send 0. So our Arduino and F are being received 0. It will turn off the lid on pin number 13. As you can see, it's a very easy and straightforward process. Now, in the next lesson, we are going to draw the user interface and codes or add few blocks to our Android application to make this happen. To make it send one when honest place to make it's in 0. Went off is best. Let's save our app. Now. I usually prefer to save these abs in all of those. So we'll write code in here who arrived lid on, off. And let's give it a number one. Now. Now let's verify and make sure everything is correct. Now we can move on to Android application. Thanks for watching this lesson. 12. 12 Making an Android App for Led On Off Practical Example: Hello and welcome to this new lesson in which you are going to explain how to design the user interface for your Android mobile application to control eyelid and turn it on and off. Now the first thing is going through that and IT have inventory buyer, I think AI tool that app inventory dot mit.edu, which will ask you to sign in with your Gmail account. Are they already have a G-mail account? Now we are here. Now you can click Start new project. Okay, Let's go back here. My projects. You can click Start new project or you can open a previous project. We already started anew project and call the clip on off. So you can write here lid off and hit. Okay. You'll be directed to this page. Now in this page, we need to add a few elements. We will start by adding list picker to pick the Bluetooth device that we want to connect to. And let's adjust how this locks. Let's first add an image before this, and we will insert a valid image here. Now, for the list, I'll put text of less picker. Let's first chairs the width and make it fill parent. Now change the text to select new tooth device. As you can see, select Bluetooth device. Let's make it Swanee clause. Now, let's add a layout. This layout arrange how items are placed on your application. We will add a horizontal arrangement. Now inside it, we need to go back to the user interface and add two buttons. So here we have fixed for water 1 and tasteful button to change the width to free parent and fall this to make it fill parent. Now the horizontal advertisement itself, Let's make it fill pair on as well. Now they look and be touched. Now, go back right on here. Show the text of 24 and the write off here. And tell you that the x 224. Now, this is the image that you want to replace where the eyelid damage. So go lead the PNG. Now, this lid locks nice. You can save this image and go back to our path. And I'm blown the file. Choose file. Now double-click valid image. As you can see now we have eyelid itself, very large image, so you need to change the words to fill parent. And now the height, we can't choose it end percentage, let's make it 60 percent. And we can even make it smaller. 43 percent. As you can see, a very large image. Now, as you can see, that image intersects with the list picker. And to avoid this, we can add another layout. But this time let's add a vertical arrangement. So let's add a vertical arrangements right here. Now we can drag this image from with inside it, and we can drag that on the image and Robert inside it. Now this is a fill parent layout, as you can see. And this is our image. Now again, you can even change this to 20 and it's going to keep getting smaller. Now let's keep it at 40. As you can see, 40 percent fill parent. And this is the lip. Now you can use scale to fit, as you can see here. And you can change this to 50. And to also hold nice Now, this is all user interface. You can also change the screen one name. You can change the properties and call it lid on. Off. Luke was up. Now as you can see, lid on, off nucleus up. That's it. Now, you can't change other properties like the background color, the icon for your app. You can choose this as the app icon and you can share the screen orientation and enable scrolling. If you have a low carb, make it responsive. Chairing the theme. As you can see, as we change the theme now, this is larger. Now we can change it to and the ark. It looks nice. Now this is the user interface. Let's move on. And let's program these elements. Now listen, go through that bloke wound. All the blocks. Now we have these elements. We have the list picker, and we have the image. We won't do anything with the image, and we have the two buttons. Now. We also have to add a Bluetooth module. So let's go back to the designer and click connectivity. Drang, the Bluetooth client and Robert here, you will see it here, and you'll also see it here on the non-visible component section. Now, let's go back to the blocks. Now we have Bluetooth clients right here. The first thing that we need to do is go through the list because Han select after picking. And as you can see, this is the after and we need our before picking. So let's go back to the list because before beginning, now, before picking and after picking is basically before clicking the component which is this select multiple device list picker. And after is after selecting something from the list. So we need to control these two. Now before beginning, we need to set the list because filaments to equal the Bluetooth devices, addresses and names. And to do that, we need to go back to the list picker, scroll down, and then go and select list because those elements, now implicit here. Now this will select all the list pick up elements to the Bluetooth client addresses and names. So let's go through the Bluetooth client. And as you can see here, we have a lot of items. What we need is Bluetooth client one that addresses and names. Now this will simply the addresses and names of Bluetooth devices available. Once we click the list pick up, because this is done before picking. Now the next thing is after picking, after clicking one of the Bluetooth devices that are available on the Sibley, what we need to do, we need to go back to the list, pick an item, and go through the SETT Lists, pick our selection. So let's look for it. Okay here, set list pick R1, the selection tool. Yes, it's right here. Now, what you need to do is to call the Bluetooth client, which is this, and connect to that address that was selected. So we need to go back to them with this client. And we need to go back to the methods or the bloke that says call the connect. Now here it is called the Connect. Now this called Connect must take an address right here. And this address will be the same colors that we selected right here. And this can be done by simply going through the list picker and select list, pick our selection. As you can see, this is it lists bigger one that selection. Now whatever you select on the list picker that Lucas client will connect to. Now, after that, we need to display a message on the list beaker. So let's go and look for the text block. Okay, Sit, list, pick up the ticks to place it right here. Now we need to add a text. So go here, go up, drag, and drop that text again, but text this one and drag it and drop it here. And here we need to write connected. So that's it. This is how we can enable the Bluetooth on our app. Now we are done with the list pickup. We need to control button one and button two. So go to Button 1, drag this, and go to button to drag this. When you click button one, we need to send a text to the glucose clans. So go to the bloodless client and look for sin text function. How they can see you have a lot of functions. Now this is the syntax function. We need to drag it twice. Here and here. Now the texts that we will send is sent using the text method that I guess the robots here, again drag it over here. Now the first button is the on button. We will send one. The second button is the off button. You will sin 0. And this was specified on our Arduino code. As you can see, one is for on high, 0 is for our floor. So this code must receive either one or 0. And this is what our app we'll do. Now. Our app is up and thready. And in the next lesson we are going to upload this app to our Android mobile form and and test this out. Facts launching this is Ashraf. 13. 13 Testing On Off App with Arduino: No one will count the singular song and which we are going to connect a lead toward Arduino board. Now, this is our Arduino ball and what you need to do is simple. You need to place this length between the ground and in number 13. And as you can see, we have two legs and the long and the short leg. So the lower one and the short bone to the ground. Now, what we will do is we are going to go to MIT App Inventory, selecting neck, and basically want to connect to the AI Companion. And let me move this aside so that you can see my While device screen. Now I companion. Now you need to have the AI lab and install on your form. So simply look folder up here. Mit Companion, as you can see, this is the app. Click on it and select scan QR code, and simply go and scan the QR code. Now, it will upload dk phi, as you can see. And now here we have the lid off. As you can see. Now, sometimes the icons doesn't really appear. As you can see here we have selectable device, but it's not visible. There is on an off ketones. Now if I click the on button, there a must, but that it must turn on. And if I click the off button and it must turn off. Now for this to happen first, we need to connect our board to the USP. Now after doing that, now, look for the code that says make sure that Arduino selected and the board directly upload the code. Still uploading. Now one of the things that I need to mention is that you need to make sure that the device is not connected when you upload the code. Because we are using the same pins, RX and TX that are doing you use to receive code from PC. So at least remove one of the VCC or ground pins to make sure that the uploading process of the core trans small game. Now go back to your device and open up that lid off glucose application and select on and off. As you can see, that's going next to toggle through device. So you need to make sure that you are connected by going to the Bluetooth menu. Now as you can see, we have it here and that current devices. Go back to the app. Click this button, select that Bluetooth device. Now we are connected and as you can see, we have the lead. Now on. Now when I click off, the LED is off and here, on, off, on, off, and so on. Now, the very same call applies for the relay example. Now, you didn't see how everything works. We have connected that Bluetooth module, which is this one. And we have connected the LED pin number 13, and we have uploaded the code. And I did this connect one of these two wires to make sure that the I'll call it, uploads it smoothly. Then I reconnected them to support you. And we did run the app first unit to pair your device, your Bluetooth, with your mobile device. Then you need to scan the code for the MIT. And you can start testing. That's it. This is how you can easily run or control your Arduino board using Android app that was just created using MIT App Inventor's. Thanks for watching this lesson. If you have any questions please ask in the Hyundai board. 14. 14 Make a Log In Protected Led Control App: Hello and welcome to the singular song inner shell. Going to make the second posit the first project who we made our lid on OFF example and we test it out. Now, we are going to add another screen, which will ask the user to enter a user name and the past hold in order to allow him to login to the lid control screen. Now, in this lesson, you'll learn how to add a password and the textbooks field to your app design. You will learn how to build apps with multiple screens. You will learn how easy it is to switch between the app screens. Now, you can consider this project as a continuous of Project one with additional features. The list controller screen is password protected. To control the lids, you must enter a valid username and password. Now, let's start a new project and call it the password. Password protected lid. Click. Okay. Now here it is. As you can see, this is the main screen. Now let's change the name to password protected lid. Now as you can see here. Now, let's first add a layout. Let's add a vertical arrangement. And inside it we'll start by adding a label. And first the layout will make it fit. Thrill parents, and same thing for the label. Now let's try it inside it. Okay, let's control login and change the text to 24. As you can see, a line to center. Now, concerto form type. And now let's add two text boxes. Now this is the first text box, and this is the second text box. Now, same thing, fault use Yukon and fill parent. And as you can see, that they will fill home someday. Or we can choose automatic and you can align it or align the text inside it to center. Now, let's add a hint for this text. As you can see here we have hint. So type your name. And the second one listed and you type your password. And I'll make it fill pair on. Same thing here. Now we need a button. Let's add and Bhutan. And inside it, let's login. Now, you can choose an image you can share with a fixed size to 24. And you can share the form TBL telephone type. As you can see, we have more than one that you can choose from. And you can even challenge though with a 100, 20%, all make it 80 percent. As you can see. Now, what if we want to center all of these elements, its symbol? You need to go back to the vertical unknown print. And from here, select center, as you can see now, the login button a center. Now we can even choose this to be a politic and this will be automatic. And as you can see, they look more convenient now. Now you can even add an image up here and listservs follow-up asphalt. Look PNG. As you can see. We have this image. Now let's go back and let's upload the picture. Click. Okay. Now what you need to do is choose fill pair on. And then here choose Fill parents. And as you can see, we have a very huge pass all the icon. Now, it's more convenient. You can choose the height to be, let's say 50 percent of the page. And as you can see, if you want, you can make it smaller, like 50% And let's say that we want it to be 50 percent. Now here it is. Now, if you own this picture to be aligned, here, you need to go and choose a layout lists say that's 1, the horizontal or vertical arrangement layout place the image inside it. Now to solve this issue, you need to go back to the width care arrangement and make it fill pair on it. And then go back to the image and what the wave and make it fail parent. As you can see now it's in the middle. It looks nice. And we can move on. Now this is the username window. And it will show the user a hint type your name, and the password it will show you. So I'm going to type his password. Now. You can choose the password to be numbers only or you can make it a read only and it will be turned to a label. Now, if you care a lot about the password and you don't want anyone to see it. You can't replace this text field with a password field. So if I go here and select placeholder text box right here, and you've got to move this text books number, tool. Click Delete. Now we have a placeholder text box. Now you can insert a hint here. Type. You'll password. Now to program this is very easy. Now, let's add another screen and call it lid on, off control. And click. Okay. Now, all AB will have two screens, not just one. And as you can see, this is one of the screens, and this is the next screen. Now, go to the blocks. In here, we are going to live the block diagram that will help us login to the second screen. And to do this, what you need to do is follow my steps. First. We need to go to the Login button, which is Button 1. And 1 button one is clicked. Now, we need to add an if statement inside this button. Now to meet than IF statement, you need to go to the control section right here. And in here you can see that we have if, then, now inside it we are going to do some logic statements. We are going to check if the username and the password matches something. Now, go to the allergic and from here, drag and drop this. And we need other one. And we need the AND function. Cuz we need to make sure that the username and the password are correct. Now we have this, this, and this. Now we need to convert. That takes that the user enters here inside that textbooks, number one. So go on, dub textbooks one that takes and place it here. And we need the password, the texts, and place it here. Now. Now we need to add something like, let's say text. You need to make sure that their username field has the name Arduino and the password field has the world, or let's say the numbers 1234. Now, if both of these conditions are correct, if the username is Arduino and the bus world is 1, 2, 3, 4. Then we need to move on to the second screen. So what we will do right here is another control components right here. So go to the Control, scroll down and open our other screen here. And you just need the other screen name has a text right here. And we already know that its lid on, off control. Can throw, let's solve that. Can throw off. That's it. Now this is the clothing structural for moving from one screen to another if the username and the password are correct. Now to test this out, Let's go back to enzymes. We can go through the Kinect and select Emulator. And this is our emulator. We will wait a few seconds for the angular took to run. Okay, done, and the password is 1234. Now once we click login, it will move to another screen which is an empty screen called lid on off control. As you can see, once we click the button, we are moved to the second screen, which is lid on, off control. That's it. Now, you can place the previous project code right here. So anyone who has the username and password can control valid. This is basically how easy it is to add a login screen to your app. Now, I can draw that second screen for you, but it will be a waste of time because we've already done this in the previous project. We just need to add that two buttons on the Bluetooth control box to the appropriate Bluetooth device. And the on-off buttons world control, the LED. That's it. If you have any question about anything, please ask and they're here on the board. Again, it's a very simple user interface, a very simple block. As you can see when the button is clicked, check if the username equals uno and the bus voltage equals 1, 2, 3, 4 open on that screen, which is this. This is the name of the other screen that we want to move on to. Now you can add more than one button. Each will move to a different screen. It's up to you, but that's it for this lesson. Thanks for watching this is Ashraf. 15. 15 Slider Application to Control Led Brightness: Hello and welcome to this new lesson in which we're going to make eyelid slider and control Bluetooth or eyelid brightness on our Arduino ball using this slide that on our Android application. This project will show you how to build a slide out of that controls the lid blindness. You will add also has a lid. Image changes color while you move the slider. In this project, you will learn how to add a slider to your app. Design. Her, leave the slider values and send them to Arduino. So to get started, we will use the very same concepts that we used before. We will start a new project. And we'll call it little slider. Now, let's reload the page. Sign-in. Start a new project and call it lives Slider. That's it. Now click Okay. Now, as you can see, this is our screen one, and we already mentioned the how to edit that provides you with the screen. Let's add a layout. I've vertical arrangement layout. Now inside it. We need to add an image. And now let's drag an image and add it inside this vertical arrangement layout, and drag it and drop it here. And let's change the width gardens when it used to be centered. Now, that works. Let's make it fill parent. Now the image inside it. Let's upload an image and go to the picture. Upload file, Choose File and select valid image. Now, as you can see, the image took away everything. Now let's scale picture and choose. That was the full pair on and the height. Let's make it 30%. Now. We need to go back here and make the height 50%. Now, this is taking 50 percent of all the Sibley in height and we can even reduce it to 30 percent. Now we can go back to the lids and make the height fill parent. As you can see now our lid locks got. Now the next step in this is adding a slider. And as you can see here, we have an element and it's called Slido. Now, you can change the width to fill parents right here. And you can't choose the minimum value to be 0, the maximum value to be 124 for now. Now. Now to move on with this, we need to add the Bluetooth would you own and go to connectivity, drag and drop Bluetooth client. The next step is adding a horizontal layout. Place it down here, change this to center, center and the width to fill parent. Inside it, we need to drag a list picker. Change the name for this list, pick out through Kinect, Bluetooth. Now once you are done and you can see, we need to go to the blocks mood. Now in here, who need to add Tunis pickers before picking and after pricking. We already explained this in the first project. So I will do this very fast. We need to set the list, pick our elements. Using the set list pick our elements method. Right here. We need to sit it to the Bluetooth client addresses and names. So go here and choose tooth client one, unnamed. Now we also need to sit the list, pick our selection. So go here. So let's pick our selection tool, that Bluetooth client and the this and name that was. After clicking. And to get this, we need to go and call lab Bluetooth. That connect method. And the address will be the list. Pick our selection, which is the item that they use are selected from the list. So I'm going to click on Load Selection. Now after this, we need to change the name of the, all the fixed or the wrist picker to that world connected. So go through list picker set lists because text tangle that now and go to text, drag and drop connected. That's it. Now we are done with the Bluetooth. We can leave it behind and we can move on with the slider and the brightness controller. Now, what we need to do is go to the slide and select one slide. The one position changed. Now, when the position change, we need to get the position, all of the thumb position, which is this variable. And we need to send this slider on some position to our Arduino. Now, go to the Bluetooth client. And as you can see here, in the Bluetooth client, we have a lot of functions and we need to send. So we will look into these functions as you can see here. We have the send one byte number. And you can drag this. And Robert here. Now the numbers that we are going to send is the thumb position. And to do this, sitting there some position, now, click here and drag sit fumbled a ship. And use the round function. Click the math. Scroll. Here's the round and get some position. Now, by using set some position around some position, we are assigning them around all of that rounded value or bad to fumbles a shim. This means we do not need to introduce a new variable. Now, let's go back here and add a text box. And let's make it with fill parent. It's with. And let's call it slider. Now. Slide dot text. And let's go back here. Now we will send that text books, the text in here and make it equal and thus lie either one position. Okay? I was kind of see, this is some position. Now we can see in you, you'll the slider, you will see our text here that's telling you where are you exactly. And let's center the text alignment. Now, go back to the blocks. Now we need to send the slider position to our Arduino ball using the Bluetooth module. And to do that, you can go to the Bluetooth client. And in here you can see we have a lot of functions. What we need to do is use one of the sin functions. As you can see here, we have synthetics since it as a list and since four is two bytes or one byte. Now we will use sinned one byte number and we will drag it and drop it here. And what we will send is basically the slide, our thumb position. So let's duplicate this, place it here, and that's it. Now, you will send via Bluetooth that slide or thumb position. And we will display it on the text. And that's it. Now, let's go to our Arduino IDE software. Now what you need to do here is simple. You need to first create a new project. Save as, and let's save it. And the coding section here. Now, the slider is basically an hour tutorials. The number three, this is the RGB. Let's control slider up, and we have numbers to this quantity. We also number 3, lead slider control. Now, after saving this, goes to the setup and write Serial.begin and thrive 9,600 and set the pin and bussers t in as output. Now we have everything ready. What we need to do next, to go to the void loop. Check if they are a silicone kitchen or not. If Serial available, smaller than 0, then there is here a communication. And that's case, we need to read the incoming data. And to read them coming data, we need to write unsigned integers. Feds equal Syria, the three heads. And this will read the incoming data. We can print it on the serial monitor. Let's print fails. Now, after doing this, we need to drive the value to our pen. So write analog, right? And in here, like a pin number. Now, just to make sure that we understand what we are doing. Let me show you an Arduino ball. Now. As you can see in this image, this is an Arduino board and we need to zoom in. Let me get it up higher quality. Now this is damage. As you can see, these are the pens. Now the pins labeled with this sign. As you can see, this small sign, our PWM enabled bell. So pin number 13 cannot be used to fade in and out Alibaba. Only these pins with this sign can be used. So we will change the number 13 with pin number three. So let's go back here, change this to three, and we have to tell it to number three. Now the next step is symbol and go back and integrate and select the pin number. And after that, since the Fed value, now sometimes you might have to map the value. You have to create a new variable final fails and write MAB. And in here you have tried that value that you want to map. And now having is basically changing that range from, let's say 0 to 200 or 51230 to 255. But we are syncing the value from our Arduino or an toilets lobar cave here. And this is the slider. And as you can see in the slide that I'm sending from 0 to 255. So the same values are sent here, so we don't need to map them again to 0, to a 155. So this will be convinced it. Now, we can't test this app in the next lesson to see if it works or not. If there are modifications, we are going to do them in that practical lesson, but that's it for this lesson. We read the incoming value, we send it to the analogWrite pin number three as a faired value and we will add a delay, 500 millisecond. Now, let's verify that said then combining everything works just fine. Thanks for watching this lesson. This is Ashraf. 16. 16 Slider Practical: This slide or light intensity control application. Now the first step is opening up the app, loading it in your Android device or more pie form. And the second step is uploading the Arduino code. So go here, open up the LED slide. The example shows this. Now I'm forgetting the Upload button. You need to make sure that you disconnected one over two power wires. For the Bluetooth module. And we already mentioned why the previous lesson. Now, click Upload and it will start uploading the code. Now once you see done uploading, you reconnect the IR that you have this connectors. And as you can see, we have eyelid on pin number 13 and ground. Let's go back to our lab and make sure that that Bluetooth module is on the parallel devices. Then collect, select, connect to Bluetooth. Select the Bluetooth device would choose fc 05. And as you can see now we have connected. Now, you can't start sending signals to your lead. And you have to select an entity. And as you can see, it's not able to decode 28.05 as an integer. So we need to go back to MIT, have inventory and select that in slider, which will this. Now, as you can see, we have a lot of options and the value is 0, the max, how value is 255? You need to go your logs. And in here, go to the math. Scroll down and select that. Now as you can see here, we have the round, which basically a blow battle turns the given number rounded to the closest interior. Now, what you need to do next is look for the value that is sent to Arduino. And as you can see here, we are sending slider on the thumb positioned directly. So sort of sending this number will send around or just numbers. And the length is connected to pin number three. And then in that we have here is connected to pin number 13. So for this to work, we need to reconnect this lead and place it on pin number 3 and do so. What we need to do is simple. Now for Russia up to work or pull the slider up to work, we need to connect pin number three. Now, this is a 120 ohm to this total. Now from that other link for this resistor must be connected to the land. And we interconnect short leg to our undoing until we can simply connect to T. And we can take away from the short leg. Everything is in place. The aluminum ball. As you can see now that it is on. And you can easily control the brightness using this slider. Now this is turning it off, but as usual, take some time to receive new commands from MIT. Now to fix this, we can go through the blocks and n here, as you can see, send one byte number round, slide around some pollution. Now. See the brightness is changing. Now, one of the other compounds that can help you do things is adding a button. You an ad about tone. Underneath this button. And you can send, now on button is clicked. We can send the thumb position. That's it. Now. You can move this click here. Make sure that your connected device. Now, once you click on the bottom, we're going to set the app. Now connect balloon device to device to connect to. Now, move this all the way. Nick the bottom. Move this all the way down the bottom. And as you can see, I have 700 on the lid off. As you can see. Now, I will send 240. Click the Send button on its own. Now you can't even scroll it and make it. Here. As you can see, the lid lie is about 25 percent. Now. We did move it to the middle. Now the light is stronger. Moved all know we double-click and we can move it down to 0 to turn up the lid. This is how easy it is to control your Arduino board using a slide that I have added the send button to send only one value and speed up the process. Thanks for watching this lesson. This is Ashraf. 18. 18 RGB Led Controller Android Application: Hello and welcome to this annulus. One knows for how long to create a project that controls RGB lids. Obviously be slide the color selector is a simple app that will select different colors and send the value. So our RGB LED. So using sliders, we will be able to control the color that all RGB LED is the sibling. Now, the first step is to create a new project. And because we need the bluetooth modules and each project we are going to replicate this project, which is basically the lid off projects. To take the Bluetooth functionality from it. Now, you can simply save product as and now we can call it RGB controller. Click Okay. Now this is a new project with the same items that shows the name of the project to RGB LED our controller. Now once you do this, we have the name collinear. We don't need the image. So you just select it and delete it. Now, after doing this, Let's move that. So let's include device up here. And as you can see, we have a vertical arrangement and the horizontal arrangement for the buttons. We can either remove the vertical arrangement or move the list, pick our inside it. So this is our list because and Let's remove the vertical arrangement. Now we have all of these items, the list because the horizontal arrangement, now we have two unknowns here. We don't want them. We want to lead these two buttons as well. And we will add three sliders inside here. So this is the first slide. Second slide, okay, we need a vertical arrangements are the organs that others aren't we in the sliders to be above each other. So on the reverse graph engine and Roebuck the slides or so left. The first slider. Second. I'm fair. Now, here we have the three sliders. Now, the Android app that we are going to create using MIT up and when Tor will have these three sliders to assign values of primary color, RGB. When these sliders are moved, these different colors are mixed, aren't shown in the Canvas. Same color code will be sin to the Arduino. We are going to run our Arduino in the next lesson. But for now, we are going to create the RGB code, these three sliders. Now, the blocks that are needed to create our Android app are basically the main two blocks for Bluetooth for you. Now, we can add our button underneath released, okay? And then if this button, and we can call it this connect F1 to disconnect from Bluetooth. Now, you can change the width over this button to be filled. Parents like this one unshared or size to 24. Now, let's call this button when the second button, okay, the first lesson will show that this is clicked. We need to call the Bluetooth client. Don't disconnect. So scroll down. Here it is. Now when the button is clicked, it will disconnect multiples. We are done with this. Now what we need to do is program the sliders. And to do so, we need to first initialize few things. So go to that look diagram. And as you can see here, we have Screen1 and choose one screen one is initialized. Now, when the screen is initialized, we need to do the following. Now, at the beginning of our time for application, we need to turn on the RGB LED, the three colors, R, G, and B. And to do so, we need to go to slide around and choose sits lie that one color lift. And complicated. Place it down, duplicate it, place it down, and change this to slide those two, and this two slide that three. Now, after this, we need to make a color. So go here, as you can see, we have this list. Make a list. So we'll add it here. And as you can see, 255 0, 0 is enough. Now, complicated, place it here, replace this with 0 and make that this is RGB are green is now on the replicated, and now blue will be on our VB. That's it. Now, this will turn on the three colors, red, green, and blue. Now the next step that we need to do is when the slide that one position changed now and go to the slider 1 and look for one slide, I'll position changed. Yes, it's right here. Now, we need to sit that color. Exactly the very same thing that we did here. Sit a slider on the color, make color. And instead of adding a value right here, you will delete it. And we want to get the thumb position. And to give us some bullshit, as you can see here, we have some woodshed. So simply drag this and the robots here. So you will get the thumb was a sham and send it to the 100, which is the first slider. Now after doing that, we can't change the canvas back ground color to the slide that collapse. But now adding Canvas for this project is optional. You can go to that sign off and go to drawing and animation and the canvas, as you can see, a cannabis is a two-dimensional, touch-sensitive rectangular panel. And what's throwing can be done on spirits can be moved. Now, we won't add it to this example to keep it simple. But you can add it that I did anaerobic anywhere he hears and program it the same way. Now, the last tip to make sure that we are sending the thumb position as a color to the Bluetooth module is using an if else statement. And as you can see here, we have logic here, we'll have half, here, we'll have fixed, and here we'll have control. We need the F, Then this here. Now if the Newton's client is connected. So go here. Look for Bluetooth. Client is connected. Here it is. Then Paul, the Bluetooth client and effort that will send the data. And in this case we will send two bytes number. So choose this one. Send to watch number and place it here. Now this will take two white somebody. And in order to send to whites number, we need to do the following. We need to go to the math section and select the blas population basics here. Now, we need to add the number right here. And we need to add around function. Go to math. Select round from here. Place it right here. Now the round function will take the slide or one thumb position. So go to the slider one from position and place it right here, 3000 here. Now we will exhibit this equation in the Arduino coding, but this is how you send two bytes number while bathroom reasons that color. Thus the first slide is expressing. Now what we are going to do next is the very same thing for a slide or 24 slider three. So I will just duplicate this, sharing this to slide or two. And here slide are three. Now there are other things that you need to change. We'll move this 0 up here and paste this down here. And we will also do the very same thing here. We remove this 0, close here we are targeting the red green. And the last one is the blue LED. Now, you need to change this. And the second two, 2000s. And on the third slide, D21 0, 0, 0, 0. Now, you can also add that look to your projects and go here through a designer. Go to this menu, select sensors and drag clock. As you can sue see, clear clock is a non-visible component that provides the instant in time. Using the anterior neck look on the form. Drag it under, over here. This is the clock, this is the interval. Now you kind of go back here. The blocks select Clock and form here, select when clock timer. We need to do the following. We will add an if else statement. Now, let's go here and add if then else statement. Here's all this. If, then else. Now, if the client is connected, then let's add a label to make things more convenient and place it here. And inside the label, Let's add connective. Okay, let's start with not connected. Chain the font size to 24. Okay? Now let's go back the blocks. Now. What we need to do is to set the label one and the text right here. And show you that the Venti and I'll takes two connected. Now after that, we will share with that color. And in this case the text color for label 1. Both are colored methods. Set the text color and from the colors shoes green. Now, otherwise, we need to duplicate this. Okay? Yes, it here. To give this, place it down here, change the colors to reds. Shares connected to not connected. Now as you can see here, we'll have connected, you have not connected. And takes, takes cutoff, takes, takes color. So if the Bluetooth is connected, it will say connected and turn that a lot too green. Otherwise, if it's not connected to show enough connected and show you our red color. That's it now. And the next lesson we are going to drive the Arduino code for this project, but that's it for now. Thanks washing. And one last tip is to change the maximum value of 255. And here 0, here 0, the same thing for the second slide, or 2550000255. Now, in the testing phase, we might change few things, but that's it for now. Thanks for watching this lesson. See you there. 19. 19 RGB LED Arduino Coding: Hello and welcome to this new lesson in which we are going to write that called all the Arduino code to communicate with that application that we just created. Now, the first thing is initializing the serial communication, 9,600 baud rate. Now, the next tip is sitting the three pins that we are going to use as our port. Then number three, number 6. Now, send a signal to these three pens. The RGB LED five, then high. And now digital live. The last one, lewis dot height 6 and high. Now, we didn't initialize the Sierra communication. We initialize the three pens as output, and we have sent three high signals. Now inside the void loop, we are going to check if there is serial communication or lattes. And to do so, you need to write if cereal and got available is more than 0. Now if it is more than 0, we need to read the incoming data and we carry the incoming data and install it. So we will start by reading using the serial function. Now the senior, the three function reads one byte, and since we are sending two bytes, as you can see here, sin two byte number and all Android application, we need to do Till thing which is create two variables. Unsigned. Integer 1 will equal 0 and literally it, and this will be the first byte. And we will do it again, unsigned. And curves tool equals Serial.read reads, and this will read the second byte. Now to get the color, we can do this using a very simple equation in color, which is the variable only equal Collage tool multiplied by 256 and added to color one. Now this is how you can give the color and you can print it out. And the serial monitor. Now, to change the RGB colors, we can do the following. We already know that we added 1, 0, 0, 0, 0, as can see here. And the 3000, 2000 until the one thousandth. And we added these to the slider position. So the value will be between 100,200 thousand. This value for the slider to all be between 2000 and 3000. And this value will be above 3000. So this will make it very easy for us to calculate things and to determine which slider is being used at the moment. And to do so, we will use our symbol if statement. Now inside this if statement will, we will ask if color is greater or equal. 1, 0, 0, 0, 0, and 0 actual that we don't use that 2000 and 3000 range. And to make sure that we are dealing with only one slide, which is the ion 1000 slider, slider three, as you can see, 10000. We know that we are dealing with 200 56 value, so it's from 0 to 255. So we can add here and, and color is less than 2000 255. Now, if anything matches, if the color is matching this range, it means that the color is coming from the first slide. In this case, we want to consider the first slider as the green slider because we know we have red, green, blue. And name it color. Now green will equal lab. And this is a function that will take the value of green and nab it to a different range. So it will take arrange from 2 thousand to 2255 and map it to 0 to 255, which is that ends that Arduino can send to the LED. Now after doing this, you can press how the semicolon press Enter and NT green one, k equals 255 minus and green. And this is to make sure that we are getting a positive value. After that, we can use the analog write function to send that value to that green or to the GI course we have RGB legs, which is the link connected to pin number 5, so it's called green one. Now we are sending this value, which is for the first slider. Let's scientific slider one. And you are sending it to Penn G or green. Now you can also print it out using serial. Print. And print the green one. After that, add a delay of ten milliseconds. Now, we are going to write that very same code for the second and the third lead saw for the second, we are going to share to change that range from okay, so here we have our problem. We have to change this to 1, 0, 0, 0, 0 to a 100 and 55. And same thing here. Same thing here. Cause this is the 1000 range. Now this is the 2000 range. So we will leave this code as it is, but we will change the color. Now, you can consider this, the degree of loss. So we'll start with the blue and we'll change these with no. And we will leave as a sudden, the second one to be the red one. Okay, here we have floor. Okay, Very good. Now for Slide tool. And this will be there between and we'll leave everything as it is. Now. We have to do the same for the third slide, dot 3000 range slider k3, 3000, 3000. And here change this to red. Red. Red here, right here, and grilled here. Lists. And lists are read. And here, red over things. And he illustrated everything in here. There's green tails, 0. Okay, Very good. Okay, great. Now we have everything that we need. Now let's verify the code to make sure that we don't have any errors. Let's save it. Okay, here we have some arrows we have to add here and here. Let's put a fight again. Here we have green was not declared. Okay. We are dealing with glue for the fired in Turkey. And I look good. I was not declared. And this school basically this five red one. Okay, Let's make sure that we don't have any syntax errors for checking this. This is the Kala prayers and this is the other place. Now, here we have a normal diet and here we have animal, right? Okay, We need to change the lead number. This is a very important note. We need to change this tool. That law to six. This one to five, and the last one to 335 unsexy. Now. Okay, now the fixed list analogWrite function, this is written correctly so there is no problem and syntax. You just need to go to the Tools bald and make sure that you're selecting Arduino Uno. Now verify the code again and everything will work just fine. As you can see, you done compiling. And that's it for this lesson. In the next lesson we are going to this, this codes and abroad it on Arduino board and test our Android application and do any modification if necessary. Thanks launching this is. 20. 22 Sensor Readings Android Application: Hello and welcome to this new lesson in which you are going to explain how to create the Android application for our sensor readings or to sublicense or readings from our Arduino board. Now, the first step is going toward that MIT App Inventory and make sure that you are signed in with your account. Now, of course I want do I don't want to go through the process of adding the Bluetooth module again and again, I will take valid on OFF example. And I will save it a new name, which is sensor readings. And now we have a new project. We can remove these items. This one, we'll leave the list picker and we will remove the buttons. Now we have everything ready. We will add clay bill. Okay, what I remove the horizontal arrangement and add a vertical layout. Now in here, I will add a label and a text box. Another label and other text box. Now, we can also add another label for the potentiometer, all of the light control sensor and another text box. Now change this name to temperature and show the form to 24. Let's change this to center. Shows this to humidity, and this to 24. Now this, Let's say that it's for life. Let's make it 14. Now. Let's change the name to reading. Reading sensors, Bluetooth app. Okay. Now let's go to the blocks. And here we have the four pricking, and here we have the after picking. Now the fourth picking will stay the same. We will do nothing to this. Now. After picking, we will leave this to the same thing, but we will add an if statement. If, then. Now F Bluetooth client is connected. Go down. The tooth is connected, let's call it a flippase client is connected. So there it is, there is Bluetooth connection. We need to do few things. We will do some set and reset functions so and go to the first item, which is in this case the list pickup. So here we have the list of the car and go through the SETT. Look for CIT list, pick out the visible scroll, scroll settlers to pick up both visible to throw onto avoid wasting time, I will duplicate it. Now change this from list picker. But before changing this, Let's do a few things. Let's remove this one. Let's go back to a xylose and add a time off. Because we don't want to read that temperature sensor reading continuously. We only need to read it without delay. So we will add a clock. Now, go back here and go back to that lock. And n here, look, force it. Time, always lie down, sit Clock 1, the time always fires. Place it here and set this to throw. So let's duplicate this. Add it here, Let's add this underneath it. Now. We need to set the labels and the text boxes to visible. So we need to go to the label, sit little physical. Okay, So through and textbooks, textbooks, one dot there is an all too true. And other labor. Now this is so liberal to throw. And the second text box, this text box visible to true. And we also have the light levels are at level three. And the last text box. Now, to make more sense when using these, we need to go back to the designer and chairs beneath. Now change this from level one to temperature. Temperature. Same for textbooks. To the chart text box. And our humidity change it to humidity. And the textbooks change it to humidity. Text box, light. Change it to light. That textbooks change it to light. The XBox. Now we have these names you want back. You can see that we have timber to sort them. Wishart text box and we have humidity, liberal humanist text box, light, light text box. Now, keep duplicating this. And add it here, here, here, here. Okay? And lastly, add it here. Now we are ready. We are, we have all of these set to Visible. Let's initialize a global variable and listen in that list. And let's create an empty list to store that. Now, let's initialize other global variable. And let's name it and put to use it later. And let's give it an initial value of an empty text. Now, go back to the clock, one clock and the time off. We need to add an if statement. So go to the control. Now, if Bluetooth control one is connected and run this and the raw material, we will add another if statement inside this one. Now, we need to make sure that we are receiving bytes that are greater than 0. To do this, go to the math, and in this and drag the equal shares this to greater. Now, go to the Bluetooth client. And Bluetooth client, the bytes available to receive is greater than 0. So what mass and drag 0. So if the incoming data is greater than 0 byte, we need to do the following. Now, if this is true, then we need to send that global input two. And since that global end, but we need to bring this basis here, select global input and we need to call the Bluetooth client received texts. Well here, look for that received texts. Place it here. Now, we need to call the bytes available to receive right here from the Bluetooth client. It's up here. So it will sit there global input to the number of bytes received using the Bluetooth client module. Now, we also need to set the global list to one of the values inside the Global end. But now that normal input has all the value that the Bluetooth client received from Arduino. Now, to get the value that we want, we need to split the incoming text. Now to split it, we need to alter the text. And here we have a split function. Now. We need to get the value of global input. And to split it at the sign that we added an Arduino code, which is this side. And this side. So go here and add a text ads the science side. Now after doing this, that global list will have the values between these signs. Now we need to set the temperature, the text. So let's go to a fixed. Okay, let's go to the temperatures text box and go to the other text function. Set temperature text box, the text to an item from the list, which is the global list that we initialized up here. To do that, we need to select list item using the list menu. And then here select list item using an index. So we'll place this here. And we will get that global list using the get function and global list. Now, the first index is one, so we will add one here and one right here. And we need to duplicate this, place, a two-year chairs this to the humidity. And the most to lubricate, place it here, change this to three shares at this two of the light. Now after doing all of this, we need to sit that global input to an empty test. So go to the text places here. And we need to set the global list to an empty list. We need to empty the list because we already took the values and we are ready to receive new values. So go to, they'll sit and select global list from here. Create empty lists. That's it. Now, if you did all of this, then once you've started the application and select the highlight of the tooth device, it will read the incoming data and split the incoming data using this sign. As you can see here, to read the temperature, then the humidity, and then we will send here. Let me send the last value, which is k, which is the light value, chains to new line since it's the last one. And in here, we will send the last variable, which is the live one, which is the analog read for light. So it will be the first value until the simulator. The second value, this is the simulator. And the third value which is liberal on. And it will read these values, disability them on these three text boxes. And when the timer returns, as you can see, this is the local country. There's this interval to 5000, just like our Arduino code. Right here. Now on the timer finishes the 51000 millisecond interval. It will go back and read the incoming data again from Arduino and this ablate here. Now let me explain this quickly. These two are basically for initialization and for making all of these items visible when picking the list. Now we initialize two global variables and put unlist list to store the incoming data because it's a list temperature, humidity, and light, and the input is to separate it. Now, here we are checking if the Bluetooth is connected or not. Now if it is connected, we need to make sure that the incoming data is more than 0 byte. We need to make sure that we are actually receiving data and bytes to split them here. Now, once we are sure we can sit that global in both to the received text using this number of wives. So now they're global and what has all the incoming bytes? After that, we need to split the global invoked and place it inside the list, which is the global list, by splitting the bytes using this separator, the one that we placed our Arduino code. After doing that, we have three values inside the list, index 1, 2, and 3. That global list index one will give us temperature. So we will display it on the temperature of textbooks, index number 2. And the global list will have the humidity solely simulate the human text box. And the third index. And that global list has the lights, soul and spirit and the light text box. And then we will empty that global in both and the list to receive new data. And the timer will tick again once we reach this time our interval. I hope that now able to think it's clear. If you have any question you can ask in the Columbia board. Thanks for watching this is Ashraf. 21. 24 Relay On Off Simple Example: Hello and welcome to this new lesson in which we are going to make a simple project which will control allele. And you can't connect anything to that, really, our fridge alarm or any other thing. The idea behind this is very simple and straightforward. So let's start by using the red gone off example as a reference for the Bluetooth. Save this project as and quality really control. I'll do in blue. Okay. Now let's move the spaces. Soviets. Now we have a new project. We can remove this image or we can live with, and I will replace it with early image. Let's change the screen. Claim. To relay control. I'll do we know Bluetooth. Now really can throw all global tool lists, find our image. Okay? I think, Hello, This will work. But let's go with this one. Or this one. Okay, save the energy. Goes Almighty up inventory. Upload a new file. Click. Okay. And now we have that image. Now. Here you can select the Bluetooth device, change the text on this to relay. On this. It really off. That's it. Now, what you need to do is symbol. You need to go back to that blocks and that before and after are the same. Now when Button 1, the OEM is clicked, send B1. When Button 2, which is the off button since 0. So this will turn on the array and this will turn the radio off. Now, let's go to the Arduino coding process. Now this is the lid off code. So we will copy this code and we will create a new called. Save it Here, Okay, Troy code. And let's give it a number from V6, relay. On off. Now we will paste the same code. As you can see, this is the incoming value from our Android application. We will connect the relay to unimpaired, and in this case it's connected to pin number 134. Easier. Let's say if you don't want to connect an actual relay and you just want to make sure that your code is working. You can use the built-in LED class right here. Now, if the seal communication is available, Read the incoming data, print the incoming data. And if the incoming data that we did read equals 1, tear monetarily, if it is 0, turn off that really it's basically the very same thing as our first application, which is the lid there and on, off tough. That's why I'm doing this very fast, so we won't waste time. Now. That's it. This is the relay on our application. Now some people prefer to do the following. And the Android application, their core with a cold and they go to the design area and they place a bottle right here, down here. So you call it Arduino boards. You get Arduino code, and let's make it 20. Now once the user clicks here, who'll create? We have one screen here. We'll add another screen and call it. How do we know? Now inside the second screen, which is the Arduino code screen, we can place the Arduino code that we have here in the early on or off. And to do so, now you can either use a label or a text box. Now, as you can see in this case, that exports has a multi-line feature. And you can paste the code here. Now. The height section and fill parent. And as you can see, the text is not visible like we want. Now, remove that text box and go back to our label. Now, in this level, you can also insert this text here. As you can see, and select the high to fill parent. And you will have to go inside the text. As you can see, it's displayed correctly here, what the sun's great correctly here. So the best scenario in these cases is to delete this, add an image, and go back to your Arduino codes. Using your mouse scroll, zoom out. So make sure that you have the full code and just one line. Now go to the snipping tool, go to the Start menu Snipping Tool, new. And in here you can copy and save this to your calls section. Now go back to the IT UP inventory. Upload the file, which is this file. Click Okay. As you can see, this is our code. Now scale to fit to the height is fill pair on. The Earth is filter on as well. So now we have our cold. People can't see the code vacant, write it on their own. Now, go to the blocks that Screen1. When the new button, which is blood or three, is connected, is clicked. We will open up however screen and you have thrived the screen name, what she's arguing, a code user text. Right? I'll quote, that's it. Now, this app will turn that off. And once you click here, you will get to the Arduino code screen. That's it for this lesson. Thanks for watching this is Ashraf. 22. 25 LCD Text Arduino Coding: Hello and welcome to this new project in which we are going to send a message to LCD display using Bluetooth. In this project, you are going to build an Android app that allows you to write messages and send them to the Arduino to do to be displayed on an LCD. You will learn how to add a text box to your design to ask for user input. How does this whole send a text message with the Arduino and how to display the text on the LCD. Now, the first step is the Arduino coding process. And to do that, you need to open up Arduino IDE software and follow my steps. The first thing that you need to do is including the wire library. Now why are will help with the L so the connection. And you need to also include the liquid crystal library. That's a balls I square see all, all to see. So I include liquid crystal underscore. Hi square c dot x. Now, you need to sit the appends to which your Arduino and LCD polled are connected. Now the LCD is connected to that appends RS and enabled pens. So to do so, we need to provide liquid crystal underscore I square C and create an object quality LCD. Now this LCD, you will take the following pens. First, we will add 0 x three f, which is the I square C address. And now select the bins 2, 1, 0, 4, 5, 6, 7, 13, and the right positive. Now, now just to make sure that you understand what's happening here. This, I'll see the will take different variables. The first thing is the address, and here we have the Enable, and here we have the chlorine on the right pen. Here we have the spin, and here we have default to the seven pens. And here we have B1. And this is that we pull. Now, if you know LCD and if you know how to interface LCD you with Arduino or animator control, you'll know what I'm talking about. The most important pens here is the RS and the Enable and the four that appends. Now, after configuring these pens, we need to make sure that we have the Arduino library, this algebra install. So you need to go to Tools and manage libraries. Now once you put the name liquid crystal ice core C, you will find that you have legals, could have cell I square. See what she does this library, just click Install. And if you move on, you can see that our other libraries as well. Now, once you have the library installed, you can see that this is now an orange. Now the next step for programming is to identify a string, to read the incoming data. Now, in the voice with a bride serial, begin to start the serial communication. And the baud rate 9,600. The LCD look to begin. And initialize the LCD for 16 character through lines. It depends on watching. I'll see you. Are you using now clear the LCD. Once you are done, go through the loop function and inside it, right while, while cereal that's available. So if there is serial communication, now, if there is no C replication, it will keep going inside this loop. That's why it's equal, equal 0. Now, if there is serial communication, it will delay. For 500 milliseconds. Then it will read the incoming data and store it inside the variable that we initiated cereal. Hey, sorry, see you. Pl, the fifth string. Now, after that, thrive LCD, both clear to peel the LCD. I'll see the cursor insert it at the first row. And the first and last print on the LCD, the incoming data or the data. That's it. We did read the incoming data from our Android application through the cereal. A connection or a serial port. Clear the LCD, sit the cursor to the first line, first graph that, and then printed that out on the LCD. And this is how simple it is. Now save your project name. It's seven, LCD and Android. I'll do enough. Now combine to make sure that we don't have any errors. Okay, Here we have, the positive is not recognized here. Now the fix this error of who you need to go here and include the LCD though ticks library verified. Now if it's not verified, then you need to go on and try another library. As you can see here is 100 verified. Now, to solve this issue, we need to make our Android or Arduino obligation recognize the LCD to fix. To do so, we need to manage libraries and add a new library. And the one that will solve the issue is then you, as you can see, this library, then you liquid crystal library. So go here and download a zip file. As you can see, this is that in GitHub.com. If I'm a aloof part T, DA, and you will equal the crystal, I will download it and open this. Now this is the library folder. As you can see. Just copy the folder and go back to the alveolar software. And go to Sketch, Include Library and the Zip library. And flown there and go to the download section. And your documents. Okay. Please on iTunes. Here's the downloads. And look for the libraries, which is the annual liquid crystal library. Now Library add it to your libraries. And now the ansi D is recognized, as you can see now it's in orange. I will add the library resources of this lecture and you can also download it from this link. Now let's verify again. Now as you can see, done combining our code works just fine. In the next lesson, we are going to draw the MIT Android app and connect the blocks to send that text to our uncontrolled or Arduino board. Thank you for watching this lesson. This is us. 23. 26 LCD Text Android Application: Hello and welcome to this new lesson in which we are going to draw our Android application that will send a text to the LCG. Simply go to your projects and select the lid on off project. Save it as I'll see the ticks. Arduino and click Okay. Now we have our new project and go down, change the name. The CD3 sends Arduino. And in here, we need to change this image with an image. So close this. Try LCD, the PNG. Here it is. Now let's save this image. Go back and upload a new image. Okay? Now, here we have an LCD. Now we need to remove one of these two buttons. We will use this button. Let's rename it to send. I'll see me. Okay, synthetics, the LCD. Now, we need to add a text box in which we are going to add the text. Now, let's other hand, try to view sense. And you can choose the appropriate to use the form, type, the words, the full parent. That's it. Now, let's go to the blocks. Now when the button is clicked, which is the first button, we need to send text. And the text that we will send to the Bluetooth client module is not this rule. This is basically the text inside the text box. So go here. Textbooks, one dot txt. So when we click the Text button, it will take that x and side effects books one and send it via Bluetooth to our Arduino board, which has a little food you'll connect it. And the Bluetooth module and our Arduino will read the incoming data, store it inside the data variable, and then this ablate on the LCD. This is how simple and straightforward this is. Now again. Let's go back here. This is the list of the car before picking for the Bluetooth, and this is after picking. Now as you can see here, the list pick up, the text is connected will be changed to connected. If there was a Bluetooth device, which is unarguably a wall, or any of our Bluetooth device. So this is our app. And you can add another button down here to view the code just like what we did in the previous lesson. So simply scroll this button, all become WK at the bottom that is already there. This button, as you can see now we have two buttons, synthetics, but we will move this down here. Now we need to make sure that this is scrollable. By clicking here. As you can see you now you can scroll. And this can be changed to Arduino codes. And when the user clicks on it, you can add another screen, call it Arduino boards. And as you can see, this is the second screen. Now we can add an image. We can go back to our codes. Minimize the space is to make it look more convenient. Now, zoom out. This is our cold. Now I'll use the Snipping Tool as what we did previously. To copy this and save it to our folder. Let's call it code. Now, when you go back here, just upload the picture. Click OK. Conflictual that the height and weight or fill parent. Okay, height and width. Now this is our codes and they both are filled parent. Now, click here, scale, picture of it. To make sure that everything is visible. Go back to the blocks per screen. And then here, 1 button 2, Let's click. We need to remove this and call the Akin throw all which is open on the screen name and plays the screen nail as a fixed. In this case, it will be doing a cold. That's it. Now you have a fully functional app that you can write a text here. Send that text is also the unsee you are being a cold. Thanks for watching this lesson. If you have any questions please ask in the queue on the board. This is us off. 24. 28 Remote Controlled Robot Android Application: Hello and welcome this in your lesson, in which we are going to create a project to build a Bluetooth remote controlled robot or to control DC motors using a Bluetooth controlled Android application. I will also show you how you can design the AB, how to control that to DC motors via Bluetooth. How to send different commands for each model. Now, the first step is replicating the app that has the Bluetooth connection, which is the lid on off. Open the app. Save Project As and let's call it remote control, a robot. Now, once we are here, we need to change the ad name. So we'll call this new remote controlled robot Bluetooth hand sense. It's not as Blade. We can't remove the Bluetooth thing. Now, we can move this image. All we can cube it and replace it with a robot. Okay, Now, let's call it robot. How would we know? Okay, I know these will work. Let's spraying. And this one, it looks very nice. Now let's save this image. Save it here, and go to your app. Now replace that with char by uploading the new picture. And this is it. Now, we have this horrible picture. Now, since selected with, with devices will be the same. We can't base it up here. Now here we have on and off. We're going to place on hand, let's say the names here. Let's call it cliff. This one, right? Let's duplicate them. Let's call this one. And this one down here too. Right? And this one is lift. Now we can add another button and place it here and call it a disconnect. Or let's call it Stop to stop the whole. We can also add another button, this one. And let's call this one's tall. And let's make the abs scrollable. Click here. And go down, click here to make sure that we can see everything. Now this, let's call it Arduino code. And let's show that in here to Arduino code that sets. Now, this is our app. The next step is programming or adding the code blocks. So let's first go to the blocks. And let's erase this here. Up, down, left, right. Okay. I'm down left, right. And this is the Arduino code button, and this is a stop button. Now, the Stop button will send S, false top, and the left button. It will call that Bluetooth client one and send a text which is L. And this one send your, okay, I've sort of been down, I think that it would be more convenient to add forward and reverse. So let's go back here and share this forward. And challenges here. For this one, let's call it reverse. And here, reverse. Okay? Now, if you feel that there are items in one location, we can add another horizontal arrangement. Go to the layout and horizontal arrangement, this one. And you can place the components right here forward and reverse. And we can make it fill parent as well. Okay? Now, K reverse is written on reverse. Now we can move on and you can do the same here and the other horizontal arrangement down here. And place these two one-sided and make it fill pair on as well. Okay? Now we can go up to the vertical arrangement and you can show the height to 40%, as you can see, but the tool hide the image. So let's make it 60 percent and see. Okay, That's what now that we have everything in place, we can go back to the blocks. And in here we can't change the fourfold with F. The reverse with our will send R. This will send lift on the right, and this will send the user to the Arduino code screen. So let's go back to the designer. The other screen, let's call it the Arduino holds. Click OK, go back to the blocks. Okay, Let's proceed here. This is the arduino calls screen, add an image just like before, and go back to the code. Okay, this is the LTV called. We need to open the code, okay, we will write the code in the next lesson. Since we didn't write unequaled. And you'll place it here. Now let's go back to the blocks screen one. Now the Arduino code will send the user to the second screen of an honor screen and then end with a new screen as Arduino board. That's it. Now, let's do a quick live in and now we have that before picking on, after picking. Now these two will make sure that we are selecting that I put with device, and it will show the word connected. After doing that, we added few items, which are these four buttons, lift right for the reverse on the Arduino code and the stop button. And now you can add a timer as well, which you can change the label fixed when the brutal device is connected, but it's not necessary. Now that's it for the coding of our user interface for the remote controlled robots. Now in the next lesson we are going chloride or Arduino cold. Thanks for watching this lesson. And this is ours. 25. 29 Remote Controlled Robot Arduino Coding: Hello and welcome to this new lesson in which we are going to code Arduino so that it can receive signals from our Android application and act accordingly. The first step is go and open up our new Arduino project. Now, let's save this project. Let's call it eight, remote controlled. And inside here, we need to initialize few variables are the beginning. Now we will use that famous 293 DIC to connect tomatoes to our Arduino board. Because as you know, if you didn't do that, your Arduino board will break and the motors will drain out of current from the Arduino pins causing it to be built. Now, first create variables int motto, pin one, telescope call it fails. Pin one. And let's give it a number like 3. First. Mortal pen tool. And let's make it a number four. Now. I see L21 times a 3. D also has an enable pen that you need to send a signal to. So nth enable one, 10 K equals six. Now we will do the same for the second motor. Second motto. When one k equals 8, 10, second motto. Then 2 equals 9. And second mode, or when to enable been sorry, to 10 equals 11. Now we have identify the pins. Let's add more valuable state into God and the flag. That will help us in the if statements to make sure that the serial only blends. Once. That's the it all the states. And we need a stop. Hey, stop bit. Now, everything will be clear in the upcoming lines and you will explain why we initiated these three variables. Now in this it up, it's convenient to use the pinMode function. And we will send the first model pen and sit it as R. We will do it again for other pens. So let's copy and paste output. Now we need sex, okay? Now the second bill to enable pill, the second modal print 1, second sprint to enable to pin. That's it now, we need to send, and thus the top here digital file. We need to send a height of one. Same thing to the enable to 10. Now sending high here on, here is basically sets enable one pin and enable tool pen so that diameter can turn on. After this, we need to initialize the serial communication, 9600 baud rate. Then we will move to the loop function. Now inside the loop function here, we will ask if there is 0 communication or not. So if Serial available is more than 0, then there's 0 communication. And in this case we need to read the incoming data so we didn't store it. We will sort it inside the state, seal the three youth and make the flag equal 0. Now, if the incoming data is if, which means forward, we will use if statement to check if the state equals F capital, which is what we send. Using R. An Android application, as you can see, the fold is sending if in that case, we will need to drive digital lights. And here we need to send the value to the first-level UPN. And the value will be high. And the second Ben, first model drill two will be low. And this will call the motors to go forward. Now. Now for the motor to go for old, after adding or sending a high signal to the first ten. For the first model, we need to make sure that the second model is helping with S. So we will send our There's derive for the second pin one until below. And we need to send another signal to the second 10. And this one must be high. Otherwise, if we have sent all of these three low, then water will keep rotating in the same location. So high and the first pin and the second branch off the second motor. So the first one we're under second motor will rotate in a way that will cause the muscle to move forward. Now, inside the if statement, we will add a nested IF. To check if a flag equals 0. Then what we need to do is serial, print a new line. And we will call it goal for all. And make love loud equals 1. That's it. Now for that second direction, which is lift, or for the right, or for any other direction, we need to cope with the very same code that we did here. And in here, we will paste on your code and change the fourfold with reverse. Now, go reverse. And what we need to do is the following. We need to change this to Low and just keep the first one high. This will cause the motor to turn left. Now. Now you need to note a very important thing. If you kept receiving, it means that you are moving either right or left. Now in this case, it can be right depending on your connection or left. But you need to make sure that you do not duplicate this cold in the left. So if we want to turn the other side, we need to cope with the very same chords and change this with L and change this to Low. And this too high I would do with nominate, but lets, it is this called. Now this will help the code turn rights. Okay? Now if we went back to our blocks, we can see for all xs reverse lift right now we have a problem which is the replication of the R. And to solve this problem, we can channel the lithosphere. Now. We can see that averse to be and keep the left and the right to the left and the right. Okay? Now, going back here, the R is right. So Tara light after turning right, what we need to do is symbol. We need to set the flag to one. After that, we will add a delay 100 to a 100 milliseconds, change state 3, state stopped to one. And that's it. Now Coby the very same code for right, and we will do it the very same thing to the left. So turn left channel, this, this will be high, this will be low. And here your L. Now, this is the lift goals. And what you can do here is simply it did the latter. He did these. So low, low, low, and then high. And here you need to turn left to turn to the cold left. And that's it. Again, if you did switch the IRS, it will turn the motors right and, uh, sort of lift. So it depends on your connection. Okay? Now let's talk about the reverse on the stop buttons. In here. We need to add the stop. So we will ask, okay, but you need to make one. It is here. You need to write L f. Before each of these else. If, else if. And the first one is F, Okay? Now we need other else-if. And inside here we are going to code thus stop button. And to do that, we need to write if state equals the S for stop or spirit stop, t equals 1. These two conditions is true. We need to use the right function to send LO signal to the four pens. And we need to set the flag. So if flag equals 0, we need to say serial.print. Stop. And the flag will equal one. Then the state's top has to be reinitialized. Still. Stop. Will equal 0. That's it. Now we have everything. There is only one thing left to be done, which is the reverse, which is the bullets are so unlike else f. Now if the state equals b, for the reverse, you will send luggage that light. Lines low, high, and the other high here, and the other low down here. Inside it, we will ask if the flag t equals 0, then serial print reverse. Now, after doing that, we need to set the flag to one. And that's it. Now, if you've done everything exactly like what I did here, the code should work. As you can see, the reverse code is low, high, high, low. You will find that the forward quote is high, low, low, high. And if you want, but you'll see that high, low, low, and so on. This is for all high, low, low, high. That's it. This is the chords. Now let's go to 50 to make sure that we don't have any syntax errors. Now, as you can see, you done compiling if you might find some syntax error like flat and sort of flag. And here we have changed thus third, stop to state still without a bit here. And the code would work just fine. Now, that's it for this lesson. If you have any questions please ask and they can on the board. Thanks for watching this is Ashraf. 26. 30 Make Money with MIT App Inventor Apps: Hello and welcome the Stimulus 1 and 0. Shang want to explain how you can monetize your app with ads. The first step is exporting your MIT App Inventor Android application in a good AI, AIA format. Go to projects, export selected project that AIA to my computer. Now, as you can see, you can download the file. And once downloaded, you need to go to cooled lush, which is another hoop side that functions. And the very same way like MIT App Inventor. They have more features like ads. Just click Create Apps and you will be redirected to the sign-up page, then you can start creating apps. Now since I already have an account, we will save some time and start by clicking Create. And now hit the Import Project button. And choose file. You need to choose the AIA file to import to your project. That's it. Now, I will mimic because I already have an app called blood slider. Now in the Import button, as you can see, this is our r and the same user in threes. And now what you should do to monetize this is hint to the monetization section. Select advertising. And as you can see here, we have a full list of adds. Adds to your Android application. I usually go with AdMob Banner. As you can see, it's placed down here. You can add that award video ad, and you can add Amazon, Facebook, and any other app. Now, in our case, I added AdMob, and when you select on it, you have to get your own ad unit ID and how to do this. It's very simple. Goal and the right had long. As you can see, Google AdMob. Now once you are here, you need to sign in with your Google account or sign up. Now, I will sign in. I already have a Google account and this is my admin account. Now, as you can see, I haven't done much in terms of earnings because I don't have time for creating Android apps. But you can. Now, what you need to do is assemble. You need to go to the app section and click Add app. In here, choose Android. Is the App listed on a supported Absolutely Not yet. Continue. Now, here you have to give up a name. You must call a slider. I'll call sliders test. Then select Add app. Now you are ready. You can select create the unit. And from here you can choose banner intercepts shell to all native app open or any other ad. Now, the one that we just added here is the bar. So we have select panel. And in here call it panache. Click Create ad unit, and simply copy this code. And go back to color. Remove this, and based your own code here. That's it. Now your app has an ad and you can upload it to the Google Play Store. Now to upload your app, you need to export it and that APK format. And if you want apt to be enabled on your app, you have to apply for two days, then contact could roller support to enable monetization. It's for free. The usual take a percentage between 5, 10% depending on how many ads are you are using. But their platform is full of features and it even has more features than MIT App Inventor. That's it for this lesson. This is how you can easily monetize your app with ads with few mouse clicks. That's it for this lesson. Thanks for watching this is.