#include"BluetoothSerial.h"
const int led=21;
const int potpin=35;
BluetoothSerial serialBT;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
serialBT.begin("esp1");
Serial.println("the bluetooth device is ready to pair");
pinMode(led, OUTPUT);
pinMode(potpin, INPUT);
}
void loop() {
if (Serial.available()){
int potvalue=analogRead(potpin);
int ledValue=map(potvalue,0,4095, 0,255);
digitalWrite(led , ledValue);
}
}