Help needed with arduino iot cloud

Hey guys......

I have an issue with my code using the IoT cloud platform. I am using an Arduino nano 33 IoT, a DHT22 sensor attached to pin 2, an LDR sensor on pin A0 and an analog temperature sensor (KY-013) on analog pin A1. And the sensors are powered from an external breadboard power supply as I am not sure if the nano 33 IoT has a 5v pin. I would like help with the code with similar code done by someone else etc.

Hey Guys…
This is the code I have an issue with… Please let me know any mistakes and whether it can be corrected

#include "thingProperties.h"
#include <SimpleDHT.h>
#define DHTPIN 2
#define relaypin 3
#define relaytimerpin 4
SimpleDHT22 dht22(DHTPIN);
void setup() {
  // Initialize serial and wait for port to open:
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  // Defined in thingProperties.h
  // Connect to Arduino IoT Cloud
     The following function allows you to obtain more information
     related to the state of network and IoT Cloud connection and errors
     the higher number the more granular information you’ll get.
     The default is 0 (only errors).
     Maximum is 4
void loop() {
  float temperature_raw = 0;
  float humidity_raw = 0;
  int err = SimpleDHTErrSuccess;
  if ((err = dht22.read2(&temperature_raw, &humidity_raw, NULL)) != SimpleDHTErrSuccess) {
    Serial.print("Read DHT22 failed, err="); Serial.println(err);delay(1000);
  temperature = read_temp(temperature_raw);
  humidity = read_hum(humidity_raw);
  float read_temp(float temp_raw){
  float temp = (float)temp_raw;
  temp = (1.8 * temp) + 32.0;
  return temp;
  float read_hum(float hum_raw){
  float hum = (float)hum_raw;
  return hum;
  if (relay.getSwitch()) {
    digitalWrite(relaytimerpin, HIGH);
    digitalWrite(relaytimerpin, LOW);
  digitalWrite(relaytimerpin, HIGH);
  digitalWrite(relaytimerpin, LOW);
void onRelayChange() {
  // Do something
void onRelayTimerChange() {
  // Do something