I'm getting this error:
/usr/local/bin/arduino-cli compile --fqbn esp32:esp32:esp32doit-devkit1:DebugLevel=none,FlashFreq=80,UploadSpeed=921600 --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/116661056/build --build-path /tmp/arduino-build-52743E81FB39DAA24ADD12C8D04500DF --library /mnt/create-efs/webide/13/e8/13e89aac54e7d22b04665ae02741cfff:farhan74/libraries_v2/SimpleTimer --library /mnt/create-efs/webide/13/e8/13e89aac54e7d22b04665ae02741cfff:farhan74/libraries_v2/TimerOne /tmp/116661056/sketch_sep16a
Using library dallastemperature_3_9_0 at version 3.9.0 in folder: /home/builder/opt/libraries/dallastemperature_3_9_0
Using library dht_sensor_library_for_espx_1_18_0 at version 1.18 in folder: /home/builder/opt/libraries/dht_sensor_library_for_espx_1_18_0
/tmp/116661056/sketch_sep16a/sketch_sep16a.ino: In function 'void setup()':
/tmp/116661056/sketch_sep16a/sketch_sep16a.ino:67:4: error: 'ECG' was not declared in this scope
ECG,
^~~
/tmp/116661056/sketch_sep16a/sketch_sep16a.ino:73:15: error: 'Spo' was not declared in this scope
xTaskCreate(Spo,"dusra",1000,NULL,1,NULL);
^~~
/tmp/116661056/sketch_sep16a/sketch_sep16a.ino:74:15: error: 'tempB' was not declared in this scope
xTaskCreate(tempB,"teesra",1000,NULL,1,NULL);
^~~~~
/tmp/116661056/sketch_sep16a/sketch_sep16a.ino:75:15: error: 'temp' was not declared in this scope
xTaskCreate(temp,"chotha",1000,NULL,1,NULL);
^~~~
/tmp/116661056/sketch_sep16a/sketch_sep16a.ino:75:15: note: suggested alternative: 'time'
xTaskCreate(temp,"chotha",1000,NULL,1,NULL);
^~~~
time
/tmp/116661056/sketch_sep16a/sketch_sep16a.ino: In function 'void loop()':
/tmp/116661056/sketch_sep16a/sketch_sep16a.ino:84:28: error: a function-definition is not allowed here before '{' token
void ECG(void*parameters){
^
/tmp/116661056/sketch_sep16a/sketch_sep16a.ino:100:26: error: a function-definition is not allowed here before '{' token
void Spo(void*parameters){
^
/tmp/116661056/sketch_sep16a/sketch_sep16a.ino:122:30: error: a function-definition is not allowed here before '{' token
void tempB(void*parameters){
^
/tmp/116661056/sketch_sep16a/sketch_sep16a.ino:138:29: error: a function-definition is not allowed here before '{' token
void temp(void*parameters){
^
Error during build: exit status 1
Code
#define BLYNK_TEMPLATE_ID "TMPLi-ilzaW4"
#define BLYNK_DEVICE_NAME "IOT based PMS"
#define BLYNK_AUTH_TOKEN "BfXLIyvrGTD4aHSl46zxH7GA_uZG0EFx"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <Wire.h>
#include<Blynk.h>
#include <BlynkSimpleEsp32.h>
#include "MAX30100_PulseOximeter.h"
#include <OneWire.h>
#include <DallasTemperature.h>
#include "DHTesp.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#define DS18B20 5
#define REPORTING_PERIOD_MS 1000
BlynkTimer timer;
int BPM, SpO2;
char auth[] = BLYNK_AUTH_TOKEN;
/*Put your SSID & Password*/
char ssid[] = "iPhone"; // Enter SSID here
char pass[] = "12345678"; //Enter Password here
DHTesp dht;
PulseOximeter pox;
uint32_t tsLastReport = 0;
const int oneWireBus = 5;
OneWire oneWire(oneWireBus);
DallasTemperature sensors(&oneWire);
void onBeatDetected()
{
Serial.println("Beat!");
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(2, INPUT); // Setup for leads off detection LO +
pinMode(4, INPUT); // Setup for leads off detection LO -
dht.setup(18, DHTesp::DHT11);
sensors.begin();
//spo2/bpm
if (!pox.begin())
{
Serial.println("FAILED");
for(;;);
}
else
{
Serial.println("SUCCESS");
pox.setOnBeatDetectedCallback(onBeatDetected);
}
// The default current for the IR LED is 50mA and it could be changed by uncommenting the following line.
pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
xTaskCreate(
ECG,
"pehla",
1000,
NULL,
1,
NULL);
xTaskCreate(Spo,"dusra",1000,NULL,1,NULL);
xTaskCreate(tempB,"teesra",1000,NULL,1,NULL);
xTaskCreate(temp,"chotha",1000,NULL,1,NULL);
}
void loop() {
// put your main code here, to run repeatedly:
//timer.run();
//Blynk.run();
void ECG(void*parameters){
for(;;){
if((digitalRead(2) == 1)||(digitalRead(4) == 1)){
Serial.println('!');
}
else{
// send the value of analog input 0:
Serial.println(analogRead(36));
}
//Wait for a bit to keep serial data from saturating
delay(1);
}
}
void Spo(void*parameters){
for(;;){
pox.update();
BPM = pox.getHeartRate();
SpO2 = pox.getSpO2();
if (millis() - tsLastReport > REPORTING_PERIOD_MS)
{
Serial.print("Heart rate:");
Serial.print(BPM);
Serial.print(" bpm / SpO2:");
Serial.print(SpO2);
Serial.println(" %");
tsLastReport = millis();
}
}
}
void tempB(void*parameters){
for(;;){
sensors.requestTemperatures();
float temperatureC = sensors.getTempCByIndex(0);
float temperatureF = sensors.getTempFByIndex(0);
Serial.print(temperatureC);
Serial.println("ºC");
Serial.print(temperatureF);
Serial.println("ºF");
delay(5000);
}
}
void temp(void*parameters){
for(;;){
float temperature = dht.getTemperature();
float humidity = dht.getHumidity();
Serial.print("Temperature: ");
Serial.println(temperature);
Serial.print("Humidity: ");
Serial.println(humidity);
delay(2000);
}
}
}