Hello,
For a project in school , i need to do several things but I had a problem with one in particular. Basically i have a xd_58c captor that mesures pulse rate and we have to had a buzzer , some leds and other stuff but we also have to display on a LCD screen the hours and if the captor is used , shows a graph from the captor on top and the values on the bottom. I don't really know how to it so if you could help me it would be nice.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH,SCREEN_HEIGHT,&Wire,-1);
#define Battementmax 550
#define BattementMin 500
bool TempsBPM=false;
bool BattementComplet=false;
int DernierBattement=0;
int BPM=0;
int faux=0;
void ecran(int valeur , int temps);
void setup() {
Serial.begin(9600);
}
void loop()
{
int temps;
Serial.println(analogRead(0));
faux=analogRead(0);
BPM=map(faux,0,1023,0,160);
// calc bpm
if(BPM>Battementmax)
{
if(BattementComplet)
{
BPM=millis()-DernierBattement;
BPM=int(60/(float(BPM)/10000));
TempsBPM=false;
BattementComplet=false;
}
if(TempsBPM==false)
{
DernierBattement=millis();
TempsBPM=true;
}
}
if((BPM<BattementMin)&(TempsBPM))
BattementComplet=true;
// output bpm to serial monitor
Serial.print(BPM);
Serial.println("BPM");
delay(1000);
ecran(BPM,temps);
}
void ecran(int valeur, int temps)
{
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
display.setCursor(0,10);
display.print(BPM);
display.setCursor(30,30);
Serial.print(analogRead(0));
}
The last bit is all I know and got taught about displaying stuff on a LCD screen.