Running the Sample Code
Update your system and make sure you have the latest versions of all required software:
opkg update opkg install wget python python-pip pip install --upgrade setuptools pip
Install the Cloud4RPi client library:
pip install cloud4rpi
mkdir cloud4rpi-omega2-python && cd cloud4rpi-omega2-python repo="https://raw.githubusercontent.com/cloud4rpi/cloud4rpi-omega2-python/master" wget $repo"/omega2.py" $repo"/led.py" $repo"/rgb_led.py"
You can install git if your board has sufficient memory and you prefer using it, and clone this repository with the
opkg install git git-http ca-bundle && git clone https://github.com/cloud4rpi/cloud4rpi-omega2-python.git && cd cloud4rpi-omega2-pythoncommand.
__YOUR_DEVICE_TOKEN__string in the led.py file with your device token using any text editor (vim, sed or other):
sed -i 's/__YOUR_DEVICE_TOKEN__/replace-this-text-with-your-real-device-token/' led.py
Notice that the device went online and started sending data.
Go to the Control Panels page and add a new control panel.
Add a new Switch widget and bind it to the
You can use this control panel to switch the onboard LED's state.
If you have an Expansion Dock, run the
rgb_led.pyexample to control the dock's RGB LED.