Git Product home page Git Product logo

iosfretxble's Introduction

iOSFretXBLE

An iOS framework for easily handling the BLE connection with the FretX device

Usage:

Implement FretxProtocol in your UIViewController. Then assign it as the delegate to the shared instance of the FretxBLE object

class ViewController: UIViewController, FretxProtocol {
    
    var fretx = FretxBLE.sharedInstance
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        fretx.delegate = self
        
    }
}

To conform with the protocol, you must overload three functions:

    public func didConnect() {
    }
    
    public func didDisconnect() {
    }
    
    public func didBLEStateChange(state: CBManagerState) {
    }

Start a scan and automatically connect to the FretX device when it's found (powered on) with:

fretx.connect()

Change the lights on the FretX device with:

fretx.send(fretCodes: [46,35,24,12,01,41,32,23,15,06])

The array to be used in fretx.send() is a [UInt8]. Each element is a two-digit number, where the first digit corresponds to the fret, and the second digit corresponds to the string. Valid values are:

Frets: 0,1,2,3,4
Strings: 1,2,3,4,5,6

where the 0th fret indicates an "open string", i.e. the blue light on the FretX device.

You can clear the LED matrix (turn off all the lights) with:

fretx.clear()

iosfretxble's People

Contributors

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