so i´ve be trying to make an glove with a heart pulse and temperature sensors, and i managed to make this code that displays the BPM from the pulse sensor on the OLED display, but i don´t know how to add the other two values on the display (umidity and temperature):
#include "U8glib.h"
#include "dht.h"
#define USE_ARDUINO_INTERRUPTS true
#include <PulseSensorPlayground.h>
dht DHT;
#define DHT11_PIN 1
const int PulseWire = A0;
const int LED13 = 13;
const int Threshold = 550;
int bpm = 0;
PulseSensorPlayground pulseSensor;
U8GLIB_SSD1306_128X64 SSD1306_Display;
void DrawHeartBeat( int pulseBPM )
{
char
szBpm[10];
SSD1306_Display.setFont ( u8g_font_courB12);
SSD1306_Display.drawStr (3,30 , "BPM:");
SSD1306_Display.drawStr (2,45 , "TEMP:");
SSD1306_Display.drawStr (3,60 , "UMD:");
SSD1306_Display.drawStr (26, 13 , " MG-MARK-2 ");
SSD1306_Display.drawLine(1,15, 128,15);
SSD1306_Display.drawFrame(0, 0, 128, 64);
SSD1306_Display.drawFrame(2,2, 21, 12);
sprintf( szBpm, "%d", pulseBPM );
SSD1306_Display.drawStr( 40,30, szBpm );
SSD1306_Display.drawBox( 4 ,4, 5, 8);
SSD1306_Display.drawBox( 10,4, 5, 8);
SSD1306_Display.drawBox( 16,4, 5, 8);
SSD1306_Display.drawBox( 22,4, 2, 8);
}
void setup(void)
{
SSD1306_Display.setFont(u8g_font_courB12);
Serial.begin(9600);
pulseSensor.analogInput(PulseWire);
pulseSensor.blinkOnPulse(LED13);
pulseSensor.setThreshold(Threshold);
if (pulseSensor.begin())
Serial.println(" pulseSensor activated ");
}
void loop(void)
{
UpdateBPM();
UpdateDisplay();
}
void UpdateBPM( void )
{
static unsigned long
timeUpdate = 0;
unsigned long
timeNow;
timeNow = millis();
if ( (timeNow - timeUpdate) < 500 )
return;
timeUpdate = timeNow;
bpm = UpdateHeartRate();
if ( bpm >= Threshold )
digitalWrite( LED13, HIGH );
else
digitalWrite( LED13, LOW );
}
void UpdateDisplay( void )
{
static unsigned long
timeUpdate = 0;
unsigned long
timeNow;
timeNow = millis();
if ( (timeNow - timeUpdate) < 250 )
return;
timeUpdate = timeNow;
SSD1306_Display.firstPage();
do
{
DrawHeartBeat( bpm );
Serial.print("BPM: ");
Serial.println( bpm );
} while ( SSD1306_Display.nextPage() );
}
int UpdateHeartRate( void )
{
return ( pulseSensor.getBeatsPerMinute() );
}
i need this project ready for the science fair next tuesday so if you guys can help me out i would be very grateful for real...