https://github.com/ananace/bitwizard-ruby
Ruby library for controlling the BitWizard boards (SPI and I2C)
https://github.com/ananace/bitwizard-ruby
Last synced: about 2 months ago
JSON representation
Ruby library for controlling the BitWizard boards (SPI and I2C)
- Host: GitHub
- URL: https://github.com/ananace/bitwizard-ruby
- Owner: ananace
- License: mit
- Created: 2014-04-12T15:36:32.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-04-22T10:45:45.000Z (about 12 years ago)
- Last Synced: 2025-02-21T04:16:47.874Z (over 1 year ago)
- Language: Ruby
- Size: 419 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
BitWizard-Ruby [](http://badge.fury.io/rb/bitwizard)
==============
Ruby library for controlling the BitWizard boards (over both SPI and I2C, though only SPI is tested for now)
Built using [pi_piper](https://github.com/jwhitehorn/pi_piper), so for now it only works on the Raspberry Pi
Installation
------------
Just run ```# gem install bitwizard``` as root to install the library.
Examples
-------
Reading PWM values from a spi_3fets board would be something as simple as;
```ruby
require 'bitwizard'
board = BitWizard::Board.detect address: 0x8a
puts "#{board.type}:"
(1..3).each do |i|
puts " #{board[i]}"
end
```
If you want to use the i2c version of the board all you would have to do is add ```bus: :i2c```
```ruby
board = BitWizard::Board.detect address: 0x8a, bus: :i2c
```
You can also use the ```bitwizardctl``` utility to perform simple actions without writing your own software, things like;
- Reading/Writing PWM values
- Getting/Setting stepper position/target/delay
- Spinning/Stopping motors