Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i am working on an iot project. i am taking data from sensors max 3 0 1 0 2 and dht 1 1 ( heart
i am working on an iot project. i am taking data from sensors max
and dhtheart rate temperature and humiditynow i am using esp wroom pins and uploading the data on arduino cloud next stage is to display data on lcd screen tft i am unable to do so i am sharing details about my code and pin connections and can you help with this code: #include "thingProperties.h
#include DHTh
#define DHTPIN
#define DHTTYPE DHT DHT
DHT dhtDHTPIN DHTTYPE;
#include
#include "MAXh
MAX particleSensor;
#include Graphics and font library for ST driver chip
#include
TFTeSPI myGLCD TFTeSPI; Invoke library, pins defined in UserSetup.h
#define DELAY
#define TFTGREY xBEF
#define TFTW
#define TFTH
unsigned long runTime ;
void setup
Initialize serial and wait for port to open:
Serial.begin;
Serial.printlnFDHTxx test!";
dhtbegin;
initProperties;
ArduinoCloud.beginArduinoIoTPreferredConnection;
setDebugMessageLevel;
ArduinoCloud.printDebugInfo;
Serial.printlnInitializing;
if particleSensor.beginWire ICSPEEDFASTUse default IC port, kHz speed
Serial.printlnMAX was not found. Please check wiringpower;
while ;
particleSensor.setupxF;
myGLCDinit; Initialize the display
myGLCDsetRotation; Adjust the display rotation as needed
myGLCDfillScreenTFTBLACK; Set initial screen color
byte ledBrightness xF; Options: Off to mA
byte sampleAverage ; Options:
byte ledMode ; Options: Red only, Red IR Red IR Green
int sampleRate ; Options:
int pulseWidth ; Options:
int adcRange ; Options:
particleSensor.setupledBrightness sampleAverage, ledMode, sampleRate, pulseWidth, adcRange; const byte avgAmount ;
long baseValue ;
for byte x ; x avgAmount ; x
baseValue particleSensor.getIR; Read the IR value
baseValue avgAmount;
for int x ; x ; x
Serial.printlnbaseValue
randomSeedanalogReadA;
Setup the LCD
myGLCDinit;
myGLCDsetRotation;
void loop
ArduinoCloud.update;
float h dhtreadHumidity;
float t dhtreadTemperature;
float f dhtreadTemperaturetrue;
if isnanh isnant isnanf
Serial.printlnFFailed to read from DHT sensor;
return;
int temperaturet ;
int humidityh ;
int heartrateparticleSensor.getIR;
float hif dhtcomputeHeatIndexf h;
Compute heat index in Celsius isFahreheit false
float hic dhtcomputeHeatIndext h false;
Serial.printFHumidity: ;
Serial.printh;
Serial.printF Temperature: ;
Serial.printt;
Serial.printFdeg C ;
Serial.printf;
Serial.printFdeg F Heat index: ;
Serial.printhic;
Serial.printFdeg C ;
Serial.printhif;
Serial.printlnFdeg F;
Serial.printlnheartrate;
myGLCDfillScreenTFTBLACK;
myGLCDsetTextColorTFTWHITE;
myGLCDsetTextSize;
myGLCDsetCursor;
myGLCDprintTemperature: ;
myGLCDprinttemperature;
myGLCDprintln C;
myGLCDsetCursor;
myGLCDprintHumidity: ;
myGLCDprinthumidity;
myGLCDprintln;
myGLCDsetCursor;
myGLCDprintHeart Rate: ;
myGLCDprintheartrate;
myGLCDprintln bpm;
delay;
void onTemperatureChange
void onHumidityChange
void onHeartrateChange
Add your code here to act upon Heartrate change
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started