Duino ຄວາມສຸກແມ່ນ joystick virtual ງ່າຍດາຍທີ່ຈະຕິດຕໍ່ສື່ສານກັບ arduino ໂດຍຜ່ານລະຫັດ bluetooth
ເບິ່ງຕົວຢ່າງກ່ຽວກັບວິທີການນໍາໃຊ້ທີ່ https://www.instructables.com/id/Simple-RC-Car-Arduino-Nano-HC-05/
***********************
ການທົດສອບ
***********************
// ການເຊື່ອມຕໍ່
// Arduino >>> bluetooth
// D10 (ເປັນ RX) >>> Tx
// D11 (ເປັນ TX) >>> Rx
#include
bluetooth SoftwareSerial (10, 11); // RX, TX
void setup () {
Serialbegin (19200); // ສະແດງກັບ Arduino IDE ຕິດຕາມກວດກາອະນຸກົມ
bluetooth.begin (9600); // ຕິດຕໍ່ສື່ສານກັບໂມດູນ Bluetooth
}
void loop () {
ໃນຂະນະທີ່ (bluetooth.available ()) // ລໍຖ້າສໍາລັບຂໍ້ມູນຈາກ bluetooth
{
char a = bluetooth.read (); // ອ່ານຂໍ້ມູນເປັນ Char ຈາກ Software Serial
Serialprint ( "ຊີຟເວີ:");
Serialprintln (a); // ຂໍ້ມູນ Print ເພື່ອຕິດຕາມກວດກາອະນຸກົມ
}
}
ອັບເດດແລ້ວເມື່ອ
4 ມ.ກ. 2020