bluetooth HC-06


35 ₪

الناشر: متجر القطع الالكترونية

القسم: مرسلات ومستقبلات

تاريخ النشر: 2021-03-28



circuit connection



code

code
نسخ
اقتباس
عرض
تنزيل
	
								
/* Bluetooth Wireless Serial Port Module (slave) connected as folHIGHs (HC-06 --> 4 pin) : VCC <--> 5V GND <--> GND TXD <--> Pin 2 (Rx) RXD <--> Pin 3 (Tx) The Bluetooth module may interfere with PC to Arduino communication: disconnect VCC when programming the board */ #include <SoftwareSerial.h> SoftwareSerial mySerial(2, 3); // RX, TX void setup() { Serial.begin(9600); mySerial.begin(9600); } void loop() { if(mySerial.available()>0) { char data = mySerial.read(); Serial.print("data received="); Serial.print(data); } }





note

#when you want to upload code to arduino the vcc wire for bluetooth will disconnect because this it use the same serial port that computer will upload the code to arduino by it . #but you can use the next #include <SoftwareSerial.h> SoftwareSerial EEBlue(10, 11); // RX | TX >>>(using this library will define new serial port) >>> in this case if the vcc wire of bluetooth is connect will not make any error





arduino mega



arduino mega code:

code
نسخ
اقتباس
عرض
تنزيل
	
								
/* Arduino Due + HC-06 (Bluetooth) -echo bluetooth data Serial (Tx/Rx) communicate to PC via USB Serial3 (Tx3/Rx3) connect to HC-06 HC-06 Rx - Due Tx3 HC-06 Tx - Due Rx3 HC-06 GND - Due GND HC-06 VCC - Due 3.3V */ #define HC06 Serial3 void setup() { delay(1000); Serial.begin(9600); HC06.begin(9600); Serial.write("\nTest Start\n"); } void loop() { while(HC06.available()) { char data = HC06.read(); Serial.write(data); HC06.write(data); } }


سلة المشتريات افراغ السلة