DHT 11 using Arduino millis function

I'am making an app to read temperature and humidity sensor by using millis function instead of delay. The bluetooth connection work just fine but i can't get the sensor data. How can i create the block to display the sensor data based on my code? I'm new to mit app inventor:)

This is my block for bluetooth but i dont know how to create block for displaying sensor datart

@Jasmine_Yahaya

here examples:

1 Like

Thankyou for the examples:) I have tried building my own blocks but it does not work.I've changed my code too aduanhjh
My goal is that the reading of sensor appear when i open the app. When i tried to use the app with arduino this messages pops up
aduan1
I'm on dead end because i need to complete this app in order to understand how to get reading from sensor so that i can work with my other sensors for my final year project
Home_Automation_System.aia (8.9 KB) This is my project file if it might help. Any suggestions and guidance is highly appreciated because i desperately need it😅

Try this
/**
Serial.print("Temperature...
...
...
*/

String send_this = String(t, 2) + "," + String(h,2);
Serial.println(send_this);

In app you receive a list with two elements.

Clock1
You can run your Clock faster once you correct your blocks.

dht 1
I've tried with the code as you suggest
Home_Automation_System (1).aia (8.9 KB)
This is the block


I still cannot get the reading displayed

For this one, i dont change the code but i changed the interface and the block
temperature_and_hum.aia (3.7 KB)
Still cant get the reading

@Jasmine_Yahaya

Have you consulted my example?

  • I use 3 variables (1, 2, 3), adapt it to two variables (1, 2).

To test set:
Arduino
const unsigned long interval = 3000;

App:
Clock1.TimerInterval = 2700

Change measurement_list by data in your code.


Clock1

You failed to update element list from incoming data.

You split a piece of irrelevant text ('-') at a character value (LF) unrelated to your actual split marker (',')

Your Clock was slow and non-repeating.

Sorry it is not about the project but i want to ask is it possible that my hc-05 broken? I have tried to receive data and send data by using bluetooth terminal but nothing displayed. I also tried many times using SoftwareSerial but it only works once and when i tried to receive/send data again nothing displayed.

No. Your device is set to 38400 baud and you have to set it to 9600 using AT commands. Tomorrow I will write a guide on that.

Edit: here a guide:

1 Like

Thanks for the guide and guidance! I also just found out that the rx tx pin needs to be cross connected to my Arduino board :sweat_smile:
Here's the result

2 Likes

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