NIR LED is my transmitter/input and photodiode is my receiver/output of the circuit. So how should i code it correctly? how should i use the analogread(), or digitalread(), these function? Thank you
Below is my currently used code
Below attached is the project sample i am following
#include "SoftwareSerial.h"
int BluetoothData;
int analogInPin = A0; // Analog input pin that the potentiometer is attached to
int out =2;
int sensorValue = 0; // value read from the pot
SoftwareSerial HC05(4,5); // RX, TX
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
pinMode(out, OUTPUT);
HC05.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
Serial.print("sensor value = " );
Serial.println(sensorValue);
delay(200);
if(sensorValue>700)
{
digitalWrite(out,1);
}
else
{
digitalWrite(out,0);
}
if (HC05.available())
{
BluetoothData=HC05.read();
Serial.println(BluetoothData);
}
}
Smartphone Based Non-Invasive Glucose Monitoring.pdf (328 KB)