Guest User

Untitled

a guest
Jun 27th, 2017
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2.  
  3. int mic = A3;    //Microphone Sensor Pin
  4. int sensorValue = 0;
  5.  
  6. const int rxpin = 1;  //set pin 1 as data receiver (it will be linked to BT module's TXD pin)
  7. const int txpin = 0;  //set pin 0 as data transmitter (it will be linked to BT module's RXD pin)
  8. SoftwareSerial bluetooth(rxpin, txpin);  //to write an easier code I gave "bluetooth" name to transmission and reception pins
  9.  
  10.  
  11. void setup(){
  12. bluetooth.begin(115200);  //Initialization of serial interface at AT mode baudrate
  13. delay(300);
  14. }
  15.  
  16. void loop(){
  17.  
  18.   sensorValue = analogRead(mic);    // read the value from the sensor
  19.   if (sensorValue > 800){
  20.     bluetooth.println(sensorValue);  //data is written in serial and sent
  21.     delay(10);
  22.   }
  23.   delay(200);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment