Giter VIP home page Giter VIP logo

bleserial's Introduction

ESP32 BLE Serial library

This library makes it simple to send and received data that would normally go to or be sent by the serial monitor. The interface is very similar so most usage is identical.

Features

Installation

  • (Make sure you can use the ESP32 with the Arduino IDE. Instructions can be found here.)
  • Download the current repository, by clicking code in the right top, and download ZIP.
  • In the Arduino IDE go to "Sketch" -> "Include Library" -> "Add .ZIP Library..." and select the file you just downloaded.
  • Select an ESP32 board in "Tools" -> "Board"
  • You can now go to "File" -> "Examples" -> "BLESerial" and select any of the examples to get started.

Example

#include "BLESerial.h"
BLESerial bleSerial;

void setup() {  
  Serial.begin(115200);
  bleSerial.begin("BLE-UART");
}

void loop() {
  //If we're connected
  if (bleSerial.connected()){  
    //Send the analog value through BLE/Serial
    bleSerial.println(analogRead(A0));
    //Send the analog value through USB/Serial
    Serial.println(analogRead(A0));
    //Wait for 0.1 second
    delay(100);
  }
}

In this example we don't redefine bleSerial as Serial as we want to use both the bluetooth serial and the regular serial monitor.

There is a connected() method that enables you to find out whether a bluetooth central manager is connected.

You will need an Ios or Android app on your phone that will connect to the Nordic BLE Serial UART service and use its associated characteristics.

To interact with this the ESP32 there are several options:

  1. Adafruit "Bluefruit le Connect" App, this lets you plot the values, see the messages, send messages and more...
  2. If you want to create your own application useing P5 you can use p5.ble.js, we made an example for plotting the values.
  3. Basic-chat which is a Bluetooth Low Energy App for iOS using Swift originally written by Adafruit. This fork is updated for Swift 4 and to easily interface with BLESerial library for esp32 on github at: https://github.com/iot-bus/basic-chat

Credits

BLESerial was written by Ian Archbell of oddWires. It is based on the BLE implementation originally created by Neil Kolban and included in the Espressif esp32 distribution.

bleserial's People

Contributors

lemio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.