哦哦var dstService = "{00000000-0000-0000-0000-000000000001}";
var dstMac = "FFFF.FFFF.FFFF";
var service;
var count = 0;
function setup() {
Bluetooth.init();
网页链接 = function(mac) {
Serial.println('paired: ' + mac);
};
网页链接 = function(mac) {
Serial.println('unpaired: ' + mac);
};
网页链接 = function(mac) {
Serial.println('connected: ' + mac);
};
网页链接 = function(mac) {
Serial.println('disconnected: ' + mac);
};
// create service
service = new BluetoothService();
// when receiving data
网页链接 = function(srcMac, srcService, dstMac, dstService, data) {
Serial.println("received from "
+ srcMac + ":" + "{904291a1-b152-4c89-bd1a-0a73f4ba3d31}" + ": " + data);
};
// start service
Serial.println(service.start(dstService));
}
function loop() {
// send one msg every few secs
service.send(dstMac, dstService, "hello " + (count++));
delay(5000);
}