项目作者: cloud4rpi

项目描述 :
Examples of Cloud4RPi client library usage on Omega2
高级语言: Python
项目地址: git://github.com/cloud4rpi/cloud4rpi-omega2-python.git
创建时间: 2017-07-27T09:35:38Z
项目社区:https://github.com/cloud4rpi/cloud4rpi-omega2-python

开源协议:MIT License

下载


Cloud4RPi Examples for Onion Omega2

Build Status

Running the Sample Code

  1. Update your system and make sure you have the latest versions of all required software:
    1. opkg update
    2. opkg install wget python3 python3-pip
    3. pip3 install --upgrade setuptools pip
  2. Install the Cloud4RPi client library:
    1. pip3 install cloud4rpi
  3. Download examples:

    1. mkdir cloud4rpi-omega2-python && cd cloud4rpi-omega2-python
    2. repo="https://raw.githubusercontent.com/cloud4rpi/cloud4rpi-omega2-python/master"
    3. wget "$repo/omega2.py" "$repo/control.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-python command.

  4. Log into your Cloud4RPi account or create a new one.

  5. Copy your device‘s Device Token. If you have no devices, create one on the Devices page and copy its Device Token.
  6. Replace the __YOUR_DEVICE_TOKEN__ string in the control.py file with your device token using any text editor (vim, sed or other):
    1. sed -i 's/__YOUR_DEVICE_TOKEN__/replace-this-text-with-your-real-device-token/' control.py
  7. Run the control.py example:
    1. python3 control.py
  8. Notice that the device went online and started sending data.
  9. Go to the Control Panels page and add a new control panel.
  10. Add a new Switch widget and bind it to the Omega LED variable.

You can use this control panel to switch the onboard LED‘s state.

If you have an Expansion Dock, bind three Slider widgets (from 0 fo 255) to RGB LED variables to control the dock’s RGB LED color.

See Also