Guides

A Guide by Humans, for Humans.

Helper Methods

Artoo provides several helper methods that you can use in your programs.

class Integer -> Numeric

def : seconds

Plain number, actually does nothing.

Example

20.seconds => 20

Returns

iteger

def : second

Plain number, actually does nothing.

Example

1.second => 1

Returns

iteger


class Fixnum

def : to_pwm

Convert to PWM value from analog reading.

Returns

iteger

def : to_pwm_reverse

Convert to PWM value from analog reading.

Returns

iteger


class : Numeric

def : from_scale(range)

Convert value from old scale (min to max) to (0..1) scale.

Params

range the range value to return

Returns

iteger

def : to_scale(range)

Convert value from (0..1) scale to new (min to max) scale.

Params

range the range value to return

Returns

iteger

def : within(range)

Keep returned value absolutely within range.

Params

range the range value to return

Returns

iteger