Split Sensor Data received

Try the "Text Compare" Block for that.

1 Like

If you stick with BLE, you may have to use bytes instead of floats because the Nano 33 on-board BLE seems to have issues with numbers. However, it should work with text strings and App Inventor can, if necessary, work with text as though it were a number.

Your particular Nano has a trick up it's sleeve - it can use Bluetooth 'Classic' and Serial Comms, much easier to work with than BLE. I don't know how you switch between the two modes though. Still, this is hypothetical really if the App is to receive the Vegetronix data.

1 Like

Ashish, your Sketch is the most scruffy I have ever seen - it has more unused/unnecessary lines than those actually used. :koala: Given that, how can we be sure that you have setup the hardware correctly?

Note that the UUIDs cannot be identical, they must be unique (Universally Unique Identifiers).

Here is a tidied-up Sketch that on a nice day should send float values to the App. Ensure the App has the new UUIDs and only floats are registered before testing. Test as an APK.

DHT22toApp.txt (3.9 KB)

1 Like

So I think you have success connecting. Here is a way to handle the data coming into the App (click on the image to view clearly):

2 Likes

Make sure you have the latest BLE Extension installed, which is currently this one (20201223):
https://www.professorcad.co.uk/appinventortips#TipsBluetooth

1 Like

Thank you so much for all your help, I will be able to test these things out on Friday. Sadly I share this board with a person I work with for a college project and he is currently using it to make sure our Vegetronix VH400 is working properly, along with our relays for a few things we just wish to turn on and combining code.

The vegetronix data, I might just scrap and not send it to the app at all. Seems more like a hassel, the sensor data is used to turn on a water pump anyways, so the app doesn't really need to show the data so long as the board turns on the pump

The code had a lot of lines commented out, because I wanted to sorta narrow out the problem. However, I truly appreciate your help on this. The nano 33 has definitely made me pull some hair out trying to make it function.

So originially when we came up with the idea of creating this project (A self-caring mini-greenhouse). We thought about using WIFI, however I am not very comfortable with making things work over WIFI yet and didn't really have the time to learn it since I am also taking 7 classes this semester for college.

Oh sorry, my andriod Device is a Samsung Galaxy S21+

Well, having slept on it, I can see I ignored my own advice
baseball-bat-smiley-emoticon

You can use one float characteristic for both float values.

I will correct my code and post it.

Well, it is a great project, you could produce an App that has some commercial viability. If your friend can get WiFi code working with the VH400 and the App, all the values could be sent via Wi-Fi.

The corrected Sketch:

DHT22toApp_2.txt (3.6 KB)

...and Blocks:

See the last post on this Forum Topic by my fellow Power User Juan Antonio:

Will this still work with BLE just incase, I wish I had spent the early time in my project going with WIFI, but sadly I am nearing the deadline heavily. So I have been pulling a lot of hair over nights trying to learn proper ways to create an app on AI2 using BLE. I do truly appreciate your help and I am hoping I can make this work tomorrow.

edit: It is not due tomorrow, but I do have to demo it a little.

Hi Ashish

The DHT22 works with BLE. I can't guarantee that the Sketch I have sent you will work as I don't have a Nano 33 nor a DHT22, but the Sketch does compile and it's similar to other projects that other Users have found success with. You just have to test it.

The snag is that the VH400 does not use Bluetooth, yet it is a very useful device for the Greenhouse. If you guys want your project to impress, try to include it.

How did your demo go? Do you still have hair? :joy:

It went really well actually! Thank you everyone for your help! Your solutions worked really well!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.