Guest User

Untitled

a guest
Mar 13th, 2013
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2.  
  3. #define RxD 0 //receive data on digital 0
  4. #define TxD 1 //transmit on digital 1
  5.  
  6. SoftwareSerial blueToothSerial(RxD, TxD);
  7. int counter = 0;
  8. int incoming;
  9. void setup(void){
  10. Serial.begin(9600);
  11. //pinMode(RxD,INPUT);
  12. //pinMode(TxD,OUTPUT);
  13. setupBlueToothConnection();
  14. }
  15.  
  16. void setupBlueToothConnection(){
  17. blueToothSerial.begin(19200);
  18. blueToothSerial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
  19. blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as "SeeedBTSlave"
  20. blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
  21. //blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
  22. delay(2000); // This delay is required.
  23. blueToothSerial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable
  24. Serial.println("The slave bluetooth is inquirable!");
  25. delay(2000); // This delay is required.
  26. blueToothSerial.flush();
  27. }
  28.  
  29. void loop(){
  30. blueToothSerial.write('x');
  31. }
Add Comment
Please, Sign In to add comment