redbearlab / nrf8001 Goto Github PK
View Code? Open in Web Editor NEWProvides simple API for nRF8001 BLE chip.
Provides simple API for nRF8001 BLE chip.
I'm starting developing with Blend board, so sorry if this is an stupid issue but maybe you can help us.
We are trying to do a broadcasting of sensor data through BLE to be read after from a smartphone app. At the moment, we are trying to write the data through the set_name() function because we just found that way to do the broadcast without pairing.
The problem appears when we try to set a variable name, it is not working at all, because just the first name written is sent, it seems the code is ignoring the rest of the set_name() calls in the loop().
I assume this is not the right way of doing it, so ¿Is there another (easy) way of sending data broadcast? ¿Or should we pair the devices and create a GATT connection?
Thank you very much.
Hi,
Im facing some compatibility issue when I am using BLE Shield together with USB Host Shield 2.0
Whenever add codes to start the USB Host Shield, BLE shield will stop working.
Any idea where can i start to troubleshoot?
#include <RBL_nRF8001.h>
#include <boards.h>
#include <SPI.h>
#include <EEPROM.h>
// for USB Host
#include <adk.h>
// for BLE
static byte buf_len = 0;
byte queryDone = false;
uint32_t timer1;
// for USB Host
USB Usb;
ADK adk(&Usb, "TKJElectronics", // Manufacturer Name
"ArduinoBlinkLED", // Model Name
"Example sketch for the USB Host Shield", // Description (user-visible string)
"1.0", // Version
"http://www.tkjelectronics.dk/uploads/ArduinoBlinkLED.apk", // URL (web page to visit if no installed apps support the accessory)
"123456789"); // Serial Number (optional)
uint32_t counter;
uint32_t sendcounter;
uint32_t timer;
bool connected;
void setup() {
Serial.begin(57600);
Serial.print("\r\nArduino Blink LED Started");
if (Usb.Init() == -1) {
Serial.print("\r\nOSCOKIRQ failed to assert");
while (1); // halt
}
// Init. and start BLE library.
ble_begin();
}
static unsigned char spi_old;
void loop()
{
spi_old = SPCR;
SPI.setBitOrder(LSBFIRST);
SPI.setClockDivider(SPI_CLOCK_DIV8);
SPI.setDataMode(SPI_MODE0);
if(ble_available())
{
byte cmd;
cmd = ble_read();
Serial.print(cmd, HEX);
// send out any outstanding data
ble_do_events();
buf_len = 0;
}
else {
ble_do_events();
if (millis() - timer1 >= 1000) { // Send data every 1s
timer1 = millis();
Serial.println(F("\nBLE not available"));
}
}
ble_do_events();
SPCR = spi_old;
SPI.begin();
buf_len = 0;
Usb.Task();
if (adk.isReady())
{
if (!connected)
{
connected = true;
Serial.println(F("\r\nConnected to accessory"));
}
}
else
{
if (millis() - timer >= 1000) { // Send data every 1s
timer = millis();
Serial.println(F("adk not ready"));
}
if (connected)
{
connected = false;
Serial.print(F("\r\nDisconnected from accessory"));
}
}
}
Please allow developers to turn off all use of the serial port by your code. The serial port is not to be used unconditionally by libraries for debugging/status, as that messes up the communication of actual data.
Also I noted that the library manager uses an old version of this code where Serial.xxxxx calls are even inline. I had to comment out all calls so I could combine a MIDI Shield with a BLE Shield.
Hai
i am using blend micro to control my devices in my project via bluetooth.Now everything is working fine but the problem is with its range i have only getting a range of 13M but that is not enough for my project so can i increase the transmission power of my board to get more range ............?
or can i increase the range by any other means.......?
Any chance that you can get the code to compile in the new 1.6.0 environment?
Arduino: 1.6.0 (Windows 8), Board: "Arduino Uno"
D:\Arduino\libraries\RBL_nRF8001\RBL_nRF8001.cpp:25:23: error: setup_msgs causes a section type conflict with __c
static hal_aci_data_t setup_msgs[NB_SETUP_MESSAGES] PROGMEM = SETUP_MESSAGES_CONTENT;
^
In file included from D:\Arduino\libraries\BLE/hal_platform.h:32:0,
from D:\Arduino\libraries\BLE/lib_aci.h:34,
from D:\Arduino\libraries\RBL_nRF8001\RBL_nRF8001.h:17,
from D:\Arduino\libraries\RBL_nRF8001\RBL_nRF8001.cpp:14:
D:\Arduino\hardware\arduino\avr\cores\arduino/WString.h:38:74: note: '__c' was declared here
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
^
D:\Arduino\libraries\RBL_nRF8001\RBL_nRF8001.cpp:388:32: note: in expansion of macro 'F'
Serial.println(F("Advertising started"));
^
Error compiling.
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
I have some issues with android, (nRF UART v2.0 APP)
I didn't receive this message "Hello World, works" when connection is established, and when I try to send a message, toast notification says that device is not UART capable, and disconnect.
Also tested with iPhone (with same app), works fine.
The README clearly states: "Before calling to ble_begin(), you can make use of ble_set_name("My BLE") to change the name." However, if you open up the simple chat example, uncomment the ble_set_name line, and then upload the program, the name will still be "BLE Shield" and not "My Name" as expected. I checked this using the Red Bear's Simple Chat iOS app.
I am using BLE Shield v2.0 on an Arduino Mega 2560 v3 using the latest version of the library. I am uploading to the board with an AVRISP MkII.
How can I make this library to compile for arduino zero ?
On blend micro i use SimpleChat.ino. On RPI3 i use https://www.npmjs.com/package/blendmicro this library. Blend micro send data to the node, and rpi3 read this data. If i send data to from blendmicro to the node, node not read. On node i use this code
var BlendMicro = require("#{__dirname}/../../");
// var BlendMicro = require("blendmicro");
var bm = new BlendMicro(process.argv[2]);
bm.on("open", function(){
console.log("open");
});
bm.on("data", function(data){
console.log(data.toString());
});
process.stdin.setEncoding("utf8");
// write data from STDIN
process.stdin.on("readable", function(){
var chunk = process.stdin.read();
if(chunk == null) return;
chunk = chunk.toString().replace(/[\r\n]/g, '');
bm.write(chunk);
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.