• Stars
    star
    248
  • Rank 163,560 (Top 4 %)
  • Language
    Ruby
  • License
    MIT License
  • Created almost 14 years ago
  • Updated over 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A ruby library to talk to Arduino without having to burn programs repeatedly to the board

Arduino ruby gem

This gem is a prototyping API for Arduino in Ruby. Helps prototype Arduino programs quickly from the computer, without the need to burn to the board frequently.

Setup:

  1. Install the gem: gem install arduino
  2. Load arduino.pde onto your Arduino dev board (just once and for all).
  3. Import the arduino gem: require "arduino"

Methods

Initializing:

#Arduino.new(port, baudrate)
board = Arduino.new("/dev/ttyUSB1")

Port is something like "/dev/ttyUSB0" on linux and COMx (COM1/COM2) on windows. Baudrate is optional. It is 115200 by default.

Setting output pins

The output pins must be set explicitly.

#Arduino.output(list_of_output_pins)
board.output(10,11,13)

You don't need to declare input pins since digital pins are input by default according to the page on the Arduino site - http://www.arduino.cc/en/Tutorial/DigitalPins

Digital I/O

  1. Arduino.setHigh(pin)
  2. Arduino.setLow(pin)
  3. Arduino.getState(pin) - returns true if pin state is high, else it returns false

Analog I/O

  1. Arduino.analogRead(pin) - returns the analog value
  2. Arduino.analogRead(pin, value) - sets the analog value

Misc

1.) Arduino.turnOff - sets all the pins to low state

2.) Arduino.close - closes serial connection. Using this makes sure that you won't have to disconnect & reconnect the Arduino again to recover the serial port.

Usage example

	# This is the blink program.

	require "arduino"

	#specify the port Baudrate is optional and set to 115200 by default
	board = Arduino.new("/dev/ttyUSB1")

	#declare output pins
	board.output(13)

	#perform operations
	10.times do
		board.setHigh(13)
		sleep(1)
		board.setLow(13)
		sleep(1)
	end

Developed for the love of creating stuff by

© 2010 Akash Manohar [email protected] under the MIT License

Credits

Thanks to the following people:

  • @unsymbol - for fixing the Ubuntu reset problem

More Repositories

1

hound

Elixir library for writing integration tests and browser automation
Elixir
1,362
star
2

heroku-buildpack-elixir

Heroku Buildpack for Elixir with nitro boost
Shell
810
star
3

mogo-chat

Beautiful team chat app written in Elixir & Ember.js
JavaScript
740
star
4

ansible-elixir-stack

Ansible role to setup server with Elixir & Postgres to deploy apps
Python
295
star
5

Python-Arduino-Prototyping-API

Helps you to quickly prototype Arduino programs, without having to repeatedly load the program to the Arduino board
Python
148
star
6

mailgun

mailgun library for ruby
Ruby
118
star
7

rotor

Super-simple build system for Elixir
Elixir
83
star
8

mail-to-json

A MailGun.com clone in under 300 lines of Elixir
Elixir
45
star
9

elixir-users

Elixir users and meetups on a map
Ruby
39
star
10

heroku-buildpack-elixir-otp-builds

Erlang OTP build scripts for the Heroku Elixir Buildpack
Shell
37
star
11

coffee_rotor

Rotor plugin to compile CoffeeScript files
Elixir
17
star
12

realm

Database-independent model layer for Elixir with validations
Elixir
11
star
13

riak_pool

Provides pooled Riak connections for Elixir apps. Re-connects automatically upon disconnection.
Elixir
9
star
14

j

a simple command-line task manager written in ruby
Ruby
7
star
15

pixelart-editor

a pixel art editor using HTML DIVs for my HackerSchool application
CoffeeScript
6
star
16

ecto-riak-adapter

Elixir
6
star
17

wordpress-deploy

🔐 Secure and 🤑 budget-friendly Wordpress setup for your digital garden 🏡
PHP
6
star
18

billmebob

a simple rails3 invoice app
Ruby
5
star
19

elixir-examples

Elixir samples
Elixir
5
star
20

stylish

Erlang library to compile SCSS files
Erlang
5
star
21

github-create

a tool to help create github repos for projects directly from terminal
Ruby
4
star
22

ennio

Elixir
4
star
23

dot-files

all my dot files belong here
Vim Script
4
star
24

Prick

Prick.js lightweight web framework for node,js. Apologies for the bad name. I named it without knowing the other meaning of `Prick`
JavaScript
4
star
25

heroku-buildpack-elixir-test

Sample app to test and play with the Heroku Elixir Buildpack
Elixir
3
star
26

Dump-app

SMS dashboard for events
Ruby
3
star
27

Java-Arduino-Prototyping-API

Java Arduino API to prototype arduino based apps in java
Java
3
star
28

phoenix-deployment-notes

Dockerfile
2
star
29

Rtree.js

Implementation of RTree in javascript. Specific to 2D structures
JavaScript
2
star
30

EnnioLisp

A Scheme interpreter in Ruby
Ruby
2
star
31

VoicedOpen

support ticketing application that supports both Bushido and non-Bushido platforms
JavaScript
2
star
32

firebrick

Elixir
2
star
33

jump-ship

JavaScript
2
star
34

hackbadge

Hackathon stats, with drama and a climax
Ruby
2
star
35

duby-workouts

Sample Android applications using Duby - a work in progress
Java
2
star
36

Pong-In-Polycode

Pong game in Polycode - work in progress
Lua
2
star
37

rad-pike

Ruby
1
star
38

job_trends

Elixir
1
star
39

power-house

Elixir
1
star
40

rails_templates

Ruby
1
star
41

hackonday

site for hackonday
Ruby
1
star
42

get_mogo_chat

Landing page website for MogoChat
Elixir
1
star
43

quicktodo

a todo list app in rails.
Ruby
1
star
44

tic-tac-toe-coffeescript

Tic Tac Toe in coffeescript
JavaScript
1
star
45

rosalind

Elixir
1
star
46

kogo

Ruby
1
star
47

SICP-excercises

SICP excercises. Says it all
Racket
1
star
48

dot-emacs

my .emacs.d dir :)
Emacs Lisp
1
star
49

ShoutJam

source code for an SMS service I operated in Feb-2009
Python
1
star
50

take_a_look

A try a writing a simple ruby debugger
Ruby
1
star
51

HashNuke

1
star
52

airport_ride

airport_ride app
Ruby
1
star
53

stpvm

stpvm
JavaScript
1
star
54

elixir-for-breakfast

Elixir
1
star
55

hello-stage

Elixir
1
star
56

darkroom-mode

git mirror for https://bitbucket.org/phromo/darkroom-mode/ Distraction-free emacs writing mode
Emacs Lisp
1
star
57

brunch-bower-babel-starter

JavaScript
1
star
58

wire

Elixir websockets server for browser-based games
Elixir
1
star
59

htdp-solutions

My solutions to the exercises in the book "How To Design Programs"
Scheme
1
star
60

graphql-tryouts

GraphQL tryouts with Rails & Python apps along with schema-stitching
Ruby
1
star
61

meteorites-data-scripts

Scripts to add country info for meteorites dataset, using Geonames API
Ruby
1
star
62

hello_plug_sessions

sample app to play with plug sessions. configured with ets session store
Elixir
1
star