Skip to content

GRamosPlux/revolution-python-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BITalino (r)evolution Python API

The BITalino (r)evolution Python API provides the needed tools to interact with BITalino (r)evolution using Python.

Dependencies

Installation

  1. Install Dependencies
  • NumPy
pip install numpy
  • pySerial
pip install pyserial
  • PyBluez
pip install PyBluez
  1. Install bitalino API package
pip install bitalino

Installation Windows 10 [Python 3.x]

For Windows 10 the installation procedure is slightly different, including some additional steps that will be presented on the following topics (required by PyBluez package):

  1. Install Dependencies
  • NumPy
pip install numpy
  • pySerial
pip install pyserial
  1. Download and start the installation of Visual Studio 2015 (https://go.microsoft.com/fwlink/?LinkId=532606&clcid=0x409)

  2. During the installation select the "Custom" option

Selection of Custom Option

  1. On the new screen, select some additional functionalities required for pyBluez installation, namely:
  • Visual C++
  • Python Tools for Visual Studio
  • Windows 10 SDK

Selection of Tools

  1. After ending step 4 you will be able to install PyBluez
  • PyBluez-win10
pip install PyBluez-win10
  1. Install bitalino API package
pip install bitalino

Documentation

http://bitalino.com/pyAPI/

Example

import time
from bitalino import BITalino

# The macAddress variable on Windows can be "XX:XX:XX:XX:XX:XX" or "COMX"
# while on Mac OS can be "/dev/tty.BITalino-XX-XX-DevB" for devices ending with the last 4 digits of the MAC address or "/dev/tty.BITalino-DevB" for the remaining
macAddress = "00:00:00:00:00:00"

# This example will collect data for 5 sec.
running_time = 5
    
batteryThreshold = 30
acqChannels = [0, 1, 2, 3, 4, 5]
samplingRate = 1000
nSamples = 10
digitalOutput = [1,1]

# Connect to BITalino
device = BITalino(macAddress)

# Set battery threshold
device.battery(batteryThreshold)

# Read BITalino version
print(device.version())
    
# Start Acquisition
device.start(samplingRate, acqChannels)

start = time.time()
end = time.time()
while (end - start) < running_time:
    # Read samples
    print(device.read(nSamples))
    end = time.time()

# Turn BITalino led on
device.trigger(digitalOutput)
    
# Stop acquisition
device.stop()
    
# Close connection
device.close()

License

This project is licensed under the GNU GPL v3

About

Python API for BITalino (r)evolution

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%