Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blocklyduino產出的BLE程式無法跟App inventor傳資料 #212

Open
jackjeanab opened this issue Aug 18, 2018 · 0 comments
Open

blocklyduino產出的BLE程式無法跟App inventor傳資料 #212

jackjeanab opened this issue Aug 18, 2018 · 0 comments
Assignees
Labels

Comments

@jackjeanab
Copy link

jackjeanab commented Aug 18, 2018

blocklyduino產出的BLE程式無法把˙7697的資料傳到手機的App inventor程式中

App inventor程式用 Cavedu所做的範例
http://blog.cavedu.com/2017/11/27/app-inventor-iot-linkit-7697%e4%bd%bf%e7%94%a8ble%ef%bc%88%e8%97%8d%e7%89%994-0%ef%bc%89%e5%82%b3%e9%80%81%e5%85%89%e6%84%9f%e6%b8%ac%e5%99%a8%e6%95%b8%e5%80%bc/

blocklyduino程式

default

blocklyduino產出的c code

/*

#include <LBLE.h>
#include <LBLEPeriphral.h>

int item;

LBLEService __periphralService("19B10010-E8F2-537E-4F6C-D104768A1214");
LBLECharacteristicInt __19b10011_e8f2_537e_4f6c_d104768a1214("19B10011-E8F2-537E-4F6C-D104768A1214", LBLE_READ | LBLE_WRITE);

void setup()
{
Serial.begin(9600);

LBLE.begin();
while (!LBLE.ready()) { delay(100); }

__periphralService.addAttribute(__19b10011_e8f2_537e_4f6c_d104768a1214);
Serial.println("BLE reday!");
Serial.print("BLE address = [");
Serial.print(LBLE.getDeviceAddress().toString());
Serial.println("]");
LBLEPeripheral.addService(__periphralService);
LBLEPeripheral.setName("LinkIt 7697");
LBLEPeripheral.begin();
LBLEAdvertisementData __advertisement;
__advertisement.configAsConnectableDevice("LinkIt 7697");
LBLEPeripheral.advertise(__advertisement);

}

void loop()
{
item = analogRead(A0);
Serial.println(item);
__19b10011_e8f2_537e_4f6c_d104768a1214.setValue(item);
delay(1000);
}

局部修改blocklyduino程式產出的c code 可以傳送資料

/*

#include <LBLE.h>
#include <LBLEPeriphral.h>

int item;

LBLEService __periphralService("19B10010-E8F2-537E-4F6C-D104768A1214");
LBLECharacteristicInt __19b10011_e8f2_537e_4f6c_d104768a1214("19B10011-E8F2-537E-4F6C-D104768A1214", LBLE_READ | LBLE_WRITE);

void setup()
{
Serial.begin(9600);

LBLE.begin();
while (!LBLE.ready()) { delay(100); }

Serial.println("BLE reday!");
Serial.print("BLE address = [");
Serial.print(LBLE.getDeviceAddress().toString());
Serial.println("]");
__periphralService.addAttribute(__19b10011_e8f2_537e_4f6c_d104768a1214);
LBLEPeripheral.addService(__periphralService);
//LBLEPeripheral.setName("LinkIt 7697");
LBLEPeripheral.begin();
LBLEAdvertisementData __advertisement;
__advertisement.configAsConnectableDevice("LinkIt 7697");
LBLEPeripheral.advertise(__advertisement);

}

void loop()
{
item = analogRead(A0);
Serial.println(item);
__19b10011_e8f2_537e_4f6c_d104768a1214.setValue(item);
delay(1000);
}

@pablosun pablosun self-assigned this Aug 28, 2018
@pablosun pablosun added the bug label Aug 28, 2018
@pablosun pablosun added this to the Beta_5 milestone Aug 28, 2018
@pablosun pablosun removed this from the Beta_5 milestone Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants