IDKHowToCodeFr's picture
Upload folder using huggingface_hub
2b49295 verified
Raw History Blame
1.3 kB
#include <Arduino.h>
// This header is automatically generated by HEARTFLOW_OS /export_tinyml
// Place the exported model.h file in the src/ directory alongside this main.cpp
#include "model.h"
void setup() {
Serial.begin(115200);
while (!Serial);
Serial.println("==========================================");
Serial.println("HEARTFLOW_OS // EDGE INFERENCE NODE ONLINE");
Serial.println("==========================================");
// Mock Telemetry Vector
// Format: [Heart_Rate, SpO2_Level, Systolic_BP, Diastolic_BP, Body_Temp]
float features[5] = {75.0, 98.0, 120.0, 80.0, 37.0};
Serial.println("Feeding telemetry payload to C-compiled Random Forest...");
unsigned long start_time = micros();
// The predict() function is defined in model.h
// Returns integer class (e.g., 0 = Healthy, 1 = Heart Disease, etc.)
int prediction = predict(features);
unsigned long end_time = micros();
Serial.print(">> INFERENCE RESULT: CLASS ");
Serial.println(prediction);
Serial.print(">> INFERENCE TIME: ");
Serial.print(end_time - start_time);
Serial.println(" microseconds");
}
void loop() {
// In a real environment, read from physical sensors (MAX30102, MLX90614) here
// then pass to predict() and emit via BLE or MQTT.
delay(5000);
}