Git Product home page Git Product logo

bluetoothcontroller's Introduction

BluetoothController

中文README

A simple bluetooth remote controller for bluetooth car.

see app/release to download apk.

English translation is also available. This picture is in Chinese because the locale in my phone is set to Chinese.

Quick Start

The application has two big discs. Every time, the program read the x coordinate of the left disc and y coordinate of the right disc. Then concatenate them together, and send through bluetooth serial.

The message format looks like -23,45\r\n. When controlling a car, you can convert it to the speed of two wheels simply.

If you are use Arduino, you can use this code to drive you bluetooth car:

void loop() {
    if(Serial.available()) {
        int x = Serial.parseInt();
        int y = Serial.parseInt();
        int left = x + y, right  = y - x;
        drive(left, right); // your car driving function
    }
}

The command form, quantification, sending frequency, and control method can be customized is the Settings.

HC-05 Bluetooth Module Connection

AT+CMODE=1          // enable connection by arbitrary device
AT+NAME=KEKE046     // set your bluetooth module name
AT+ROLE=0           // Android phone seems to be always Master Mode
AT+PSWD=123456      // set password

First pair with the Bluetooth module in the Android Bluetooth settings, and then connect in the software.

Fast Command

The L1, L2, R1, R2 buttons at the top can send predefined command conveniently. You can change the default command in the Settings.

Tricks

Command generation is based on string format.

String cmd = String.format(format, x, y);

Special format may make programming quick:

"%+04d, %+04d" completed the leading zeros, then you can use:100 * buf[0] + 10 * buf[1] + buf[2] to convert string to integers.

"%2$d, %1$d" can exchange x and y coordinate, sometimes helps.

"C%+04d%+04d" can create a character 'C' in each coordinate message. You can distinguish coordinate message from other command easily.

bluetoothcontroller's People

Stargazers

 avatar  avatar

Watchers

 avatar  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.