spoutnik97 / react-native-arduino-ble-example Goto Github PK
View Code? Open in Web Editor NEWAn example of communication between a BLE module connected to an Arduino and a React Native application
An example of communication between a BLE module connected to an Arduino and a React Native application
You have to ask the user to enable the Bluetooth otherwise this will fail.
This must be before device-scanning command.
Galaxy A71
Android-version 11 (Knox 3.7)
tried to run this example on Pixel 3A Android phone, kept getting permission denied errors, found articles about adding a PermissionsAndroid function to request permission for coarse location, which prompted for the permission, but when allowed i received the access granted log, but the scan still reported denied ble permission
I'm a complete newbie with React-native, so might be entirely doing something wrong.
code as follows:
```
const requestBlePermission = async () => {
try {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION,
{
title: "Bluetooth location position",
message:
"Grant access to coarse location for ble",
buttonNeutral: "Ask Me Later",
buttonNegative: "Cancel",
buttonPositive: "OK"
}
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log("access granted");
} else {
console.log("access denied");
}
} catch (err) {
console.warn(err);
}
};
```
Then in the ListHeaderComponent i have a button with the following:
```
<View style={styles.sectionContainer}>
<Text>Try permissions</Text>
<Button title="request permissions" onPress={requestBlePermission} />
</View>
```
Im having a problem to connect this app to a ble device. They dont receive the data from device and have some bugs to show the characteristic of the device.
hey @Spoutnik97 ,
this is how characteristic is setup in arduino for writing purpose
ble.println(F("AT+GATTADDCHAR=UUID=0x2A19,PROPERTIES=0x08,MIN_LEN=1,DESCRIPTION=Elevation,VALUE=0"));
when writing from mobile app to BLE module, i get following error
[BleError: Characteristic 00002a19-0000-1000-8000-00805f9b34fb write failed for device 62AB8388-FBA9-52AE-ECDE-53149D5147E0 and service 0000160f-0000-1000-8000-00805f9b34fb]
hi.
I made a connection to the arduino nano 33 ble sense card using this example. There is a gps sensor connected to the development board and it can send some parameters to the phone right now. But I want to parse the data and show it on the screen in graphic form. how can I do that? I looked through the library files and the code. data is using separate service and characteristic uuid.
Hello there. I tried the sample code in my own application and the connection was made. I can receive data from my Arduino, but after a while it disconnects by itself and I encounter error codes due to disconnection.
What is the reason for it shutting down on its own?
At the same time, when I press the (disconnect) button and want to return, the system throws me back, but when I want to connect again, I encounter an error.
Thank you.
Hello,
I have turn on the bluetooth and localisation but the folowing error : [BleError: Device is not authorized to use BluetoothLE] keep stay. Do you have a solution ?
@Spoutnik97 Great article. I got same hardware as you described in article. I am getting this error from hardware side "Couldn't find Bluefruit, make sure it's in CoMmanD mode & check wiring?" do you mind sharing detail schema diagrams ? i think i might not have correct wiring between bluetooth module and UNO R3 ?
NO error not Gating device list Around my phone, Can you help ?
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.