#include <Wire.h>
#include <SoftwareSerial.h>
SoftwareSerial BTserial(2,3);
int analogInput = A0;
const int sampleWindow = 50;
unsigned int sample;
void setup(){
BTserial.begin(9600);
Serial.begin(9600);
pinMode(analogInput, INPUT);
}
void loop(){
unsigned long startMillis = millis();
unsigned int PeaktoPeak = 0;
unsigned int SignalMax = 0;
unsigned int SignalMin = 675;
while ( millis() - startMillis < sampleWindow ){
sample = analogRead(analogInput);
if (sample < 675) {
if (sample > SignalMax){
SignalMax = sample;
}
else if (sample < SignalMin){
SignalMin = sample;
}
}
}
PeaktoPeak = SignalMax - SignalMin;
float MeterValue = ( PeaktoPeak * 3.3 /675) * 10;
BTserial.println(MeterValue*10);
delay(100);
}
Immediate guidance needed
Hi ,
i'm working dB meter project. I'm new to arduino programming , i like to know in which bit i'm getting sensor data from pin A0. and sending the sensor to bluetooth. I need to mention in which byte my sensor data available.
Kindly help me