Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ev3dev_ruby

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ev3dev_ruby

  • 0.2.1
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

ev3dev ruby binding for LEGO Mindstorms EV3

ev3dev_ruby is a gem to controll sensors and motors on EV3 using Ruby on ev3dev OS.
ev3dev OS is a Debian Linux-based operating system for LEGO Mindstroms EV3.

  • ev3dev OS version; ev3dev-jessie-2015-12-30

Install ev3dev OS

See ev3dev OS website

Install ev3dev_ruby on EV3

SSH remote access to the EV3 from PC

(default ev3dev user; robot, password; maker)

$ ssh robot@ev3dev.local

then

robot@ev3dev:~$ sudo apt-get update
robot@ev3dev:~$ sudo gem install ev3dev_ruby

Run examples

1. Copy the examples to the /home/robot directory in ev3dev from PC.

(for OS X user; )

$ scp -r /Users/xxx/Downloads/ev3dev_ruby-master/examples robot@ev3dev.local:/home/robot

2. Run the program

There are two different ways to run the program.

A. Remote access from PC
robot@ev3dev:~$ cd /home/robot/examples
robot@ev3dev:~$ cd motor
robot@ev3dev:~$ ruby midiummotor.rb
B. File Browser on EV3
1. Add execute permission
robot@ev3dev:~$ cd /home/robot/examples
robot@ev3dev:~$ cd motor
robot@ev3dev:~$ ls -l
...
-rw-r--r-- 1 robot robot  474 Jan 18 16:18 midiummotor.rb
...
robot@ev3dev:~$ chmod +x midiummotor.rb
robot@ev3dev:~$ ls -l
...
-rwxr-xr-x 1 robot robot  474 Jan 18 16:18 midiummotor.rb
...
2. File Browser

Select the program and push the center button on EV3.

irb

You can also run programs using irb.

robot@ev3dev:~$ irb
irb(main):001:0> require 'ev3dev'
=> true
irb(main):002:0> mm = Ev3dev::Motor.new 'B'
=> #<Ev3dev::Motor:0x193890 @device_path="/sys/class/tacho-motor/motor0">
irb(main):003:0> mm.device_path
=> "/sys/class/tacho-motor/motor0"
irb(main):004:0> mm.driver_name
=> "lego-ev3-l-motor"
irb(main):005:0> mm.address
=> "outB"
irb(main):006:0> mm.commands
=> "run-forever run-to-abs-pos run-to-rel-pos run-timed run-direct stop reset"
irb(main):007:0> mm.stop_commands
=> "coast brake hold"
irb(main):008:0> mm.duty_cycle_sp 100
=> #<Ev3dev::Motor:0x193890 @device_path="/sys/class/tacho-motor/motor0">
irb(main):009:0> mm.command 'run-forever'
=> #<Ev3dev::Motor:0x193890 @device_path="/sys/class/tacho-motor/motor0">
irb(main):010:0> sleep 3

=> 3
irb(main):011:0> mm.command 'stop'
=> #<Ev3dev::Motor:0x193890 @device_path="/sys/class/tacho-motor/motor0">
irb(main):012:0>

ev3dev API

(Also checkout examples)

Motors

Sensors

EV3 Devices

The EV3 device below are not supported yet.

More Info

FAQs

Package last updated on 13 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc