How to read a String value and toggle an output based on said value.

Hello all.

I have a 433 MHz ASK-based receiver that uses the RadioHead library that receives telemetry from a DHT-11 sensor and I’m trying to get an LED to turn/off at at a given arbitrary value. (When it gets cold outside)

I’m a noob but I’m using friggin’ code tags.

  433 MHz RF Module Receiver Demonstration 2
  Demonstrates 433 MHz RF Receiver Module with DHT-22 Sensor
  Use with Transmitter Demonstration 2
  DroneBot Workshop 2018
// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library 
#include <SPI.h>

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

#define LED_PERFECT 2 // LED output Pin 2

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Define output strings
String str_humid;
String str_temp;
String str_out;
// Create Amplitude Shift Keying Object
RH_ASK rf_driver;
void setup()
    // Initialize ASK Object
    // Setup Serial Monitor

      // initialize the LCD

  // Turn on the blacklight and print a message.

  // use Arduino pins
  pinMode(2, OUTPUT);// set pin 2 as output
void loop()

  delay(100); // needed?

    // Set buffer to size of expected message
    uint8_t buf[11];
    uint8_t buflen = sizeof(buf);
    // Check if received packet is correct size
    if (rf_driver.recv(buf, &buflen))
      // Message received with valid checksum
      // Get values from string
      // Convert received data into string
      str_out = String((char*)buf);

      // Split string into two values
      for (int i = 0; i < str_out.length(); i++) {
      if (str_out.substring(i, i+1) == ",") {
      str_humid = str_out.substring(0, i);
      str_temp = str_out.substring(i+1);
      // Print values to Serial Monitor

      Serial.print("Humidity: ");
      Serial.print("  - Temperature: ");

      // Print values to LCD
      lcd.print("Humidity: ");
      lcd.print("Temperature: ");

   // if temperature goes below 80, turn the LED OFF
   if( < 80.0 ){
    digitalWrite(2, LOW);// set pin 10 LOW
    digitalWrite(2, HIGH);// set pin 10 HIGH



Feel free to tell me what I’m doing wrong.

I’m a noob, that’s why I’m here.