Prerequisites
- You’ve already have Raspberry Pi 2B/2B+
- Raspbian has been installed on your Raspberry Pi
- Make sure your Raspberry Pi has Internet access
Step 1: Downloading and Configuring Ruff SDK
- Download Ruff SDK and extract the contents。
Configure the environment variables
RUFF_HOME
andPATH
.
Note: The methods below will apply only to your current session. Please refer to Environment Variables Configuration for instructions on making the configuration permanent.Linux / OS X
Open the terminal and execute the following commands one by one, replacing
/path/to/ruff-sdk
with the path of your extracted SDK:export RUFF_HOME=/path/to/ruff-sdk
export PATH=”$PATH:$RUFF_HOME/bin”Windows
Open cmd and execute the following commands one by one, replacing
X:\path\to\ruff-sdk
with the path of your extracted SDK:set RUFF_HOME=X:\path\to\ruff-sdk
setx PATH “%PATH%;%RUFF_HOME%\bin”
Now execute
rap --version
in the command line. If the version of rap is printed as expected,PATH
has been successfully configured.Note: Ruff SDK contains two executable files:
rap
andruff
.rap
is the development toolkit with features like device pairing, application initialization, and driver and module managing.ruff
is the runtime of Ruff. The PC version ofruff
targets testing and simulation.
Step 2: Downloading and Configuring Ruff for Raspberry Pi
- Download Ruff for Raspberry Pi. Take 1.2.0 as example.
Transmit ruffos-rpi-1.2.0.zip to your Raspberry Pi
scp /path/to/ruffos-rpi-1.2.0.zip your_pi_user@your_pi_ip:/tmp
Login your Raspberry Pi
ssh your_pi_user@your_pi_ip
Extract the package
cd /tmp/
unzip ruffos-rpi-1.2.0.zipRun installation script
cd ruffos-rpi-1.2.0
chmod +x install.sh
./install.shEnable I2C on Raspberry Pi
Edit /boot/config.txt
as follows and restart your Raspberry Pi.
# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
Step 3: Creating a Project
Create a new project folder (e.g.,
hello-ruff
). Change the directory to the created folder and use rap to initialize the application. Note: Create your new project folder outside of the Ruff SDK directory.mkdir hello-ruff
cd hello-ruff
rap init -b rpi-2bRaspberry Pi 2B is specified here as board argument for init task.
Fill in information as prompted. You can use default values for all fields.
rap
will initialize the project, download configuration for the development board, and generate the hardware configuration file (ruff_box.json
).
Step 4: Connecting a Device
Execute the command
rap scan
in the application directory to scan your Ruff development board:rap scan
If everything goes well, you should see your Ruff device in the list, as follows:Scanning (this will take 10 seconds)...
* [unnamed] - 192.168.31.123
Scan completed.
? select a device to interact: (Use arrow keys)
[unnamed] - 192.168.31.114
- Press enter to select your device, and
rap
will remember it for future operations. This only takes effect in the application folder. Follow therap
prompts to set for the development board. You may also set up a password to avoid (to some degree) unauthorized operations.
Step 4: Getting Started
Refer to Getting Started, it’s time write your own Ruff application.