EN
Cloud
R1BBIT · COMMUNITY

Projects

A question from the R1BBIT community

Widgets — Getting Started

Add functionality to send variables to the cloud server.
Widgets — Getting Started

R1 BASIC
CONFIG
    ONE_WIRE 12
ENDCONFIG

VAR T, H, F                 
// Declare variables:
// T – temperature in Celsius
// H – humidity in percent
// F – temperature in Fahrenheit

DHT_INIT(T, H, 300)        
// Initialize DHT temperature & humidity sensor
// T will store temperature (°C)
// H will store humidity (%)
// 300 ms – sensor measurement interval

DISPLAY_INIT(I2C, HD44780, 20, 2)  
// Initialize LCD display
// I2C – communication interface
// HD44780 – display controller
// 20 columns, 2 rows

VARS_PUBLISH(F,H)   // Sends the values of variables F and H to the server via a Wi-Fi connection

WHILE(1)                  
// Infinite loop for continuous measurements
    F = T * 9 / 5 + 32     
    // Convert temperature from Celsius to Fahrenheit
    DISPLAY_TEXT(0, 0, "Temp: ", F.0, "F", Font_7x10, 1, 0x0000)  
    // Display temperature on row 0 of the LCD
    DISPLAY_TEXT(0, 1, "Hum : ", H.0, "%", Font_7x10, 1, 0x0000)  
    // Display humidity on row 1 of the LCD
    PAUSE 1000             
    // Wait 1000 ms (1 second) before the next measurement
WEND                      
// End of infinite loop
1
0 replies

Sign in to reply