APP FOR DHT22 WITH ARDUINO BLE AND FLUTTER BLUE
So have you looked all around the web to find some information about the bla applications with arduino and flutter, but you didnt find any explanation for how to use them, or maybe you found some example, but you didnt find the quietest. Have you tried to connect temperature and the humidity module, but you didnt find a way so dont worry. I succeed in that task and i will share with you my accomplishment and uh. Yes, you got. You have arduino bla library and also you got the flatter blue library from flutter. Yes, so now we will see how to do that. I will explain to you and dont worry. I will leave the code somewhere. I dont know maybe on github dont worry. I will figure out now i didnt do anything and yes, so hello back guys. We are in the arduino ide and i will explain you very briefly. The code, as you can see its very simple. There is not so much going on. You just specify the dht pin the tht type. You include the libraries of course, otherwise it wont work and make sure to import the arduino bla library, this one im selecting. Then you specify the service. You can call it whatever you want, in my case its a temp um and then we add the characteristics. Sorry, im bad with english, so we specify the temp chart and the humidity chart, and you can call this whatever you want as well this one and then we initialize the dht module.
Then we go to the setup, and here you just have to set the local name for your device of course, and we go then to advertise the service and when then we add the characteristics to the uh service uh and then finally, we added the service. I dont know if this is the correct order, but whatever it works, so yeah no problem. Okay, then we start advertising and finally, in the loop we just calculate measure the temperature humidity, of course, and then you write the value to the bla characteristics in this part. So we will move on on the flatter part in a short, maybe next week in the real time, okay guys. So now we are in the android studio and um. I will show you the code, not all of it, because its very long and i dont understand it pretty much. I will just explain to you what i changed in order to let it work. Of course, i found all this part. It was already made. I didnt do anything i just copied it and pasted, and after two weeks i figured out what i had to change. This was the problem. When i first tried to send the data from the arduino to my application, flutter application it was received, but not in a way that was understandable. I dont know if this word exists, but i had just like a string of numbers that didnt mean really anything and after a while, i understood that it was like um.
You need eight, i dont know to be honest and that i had to translate that format. To a float that we want so like a temperature or humidity 23.9 or whatever it is, and this part was made here, we added we received the byte list and we translate it into you intake please. I dont understand this, but it works. So if you understand, maybe you can explain me in a comment and then we translate it into a float list and then we just print to the result thats it. I will show you how the application work, and hopefully you will be happy so, as you can see, this is the flatter application. Its very simple: there is not so much going on and in the bottom right you can find four devices with the ple of course, and there you have it the dht 22. So we connect to it. We refresh and then just a moment. We can show the service which, in our case, has two characteristics for the temperature we have 22.7 and for humidity 85.6 and yes, thats it its very basic, but it works so its okay, okay, guys so thats it for today.