SHARE
TWEET

Untitled

a guest Mar 24th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <SoftwareSerial.h>
  2.  
  3. SoftwareSerial mySerial(5,6); // RX, TX
  4.  
  5. int led = 3;
  6. int bt = 2;
  7.  
  8. void setup()
  9. {
  10. mySerial.begin(9600);
  11.  
  12. pinMode(LED, OUTPUT);
  13. pinMode(BTN, INPUT);
  14.  
  15. }
  16.  
  17. void loop()
  18. {
  19.   int a = analogRead(BTN);
  20.   mySerial.println("BT value : ");
  21.   mySerial.println(a);
  22.   if (a >= 100)
  23.   {
  24.     digitalWrite(LED,HIGH);
  25.     delay(100);
  26.     digitalWrite(LED,LOW);
  27.     delay(100);
  28.   }
  29.   else
  30.   {
  31.     digitalWrite(LED,LOW);
  32.   }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top