Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Examples of Cloud4RPi client library usage on Raspberry Pi

License

NotificationsYou must be signed in to change notification settings

cloud4rpi/cloud4rpi-raspberrypi-python

Repository files navigation

Build Status

This example demonstrates different scenarios of using Cloud4RPi service on Raspberry Pi:

  • Monitoring events
  • Controlling a GPIO pin
  • Monitoring temperature with the DS18B20 sensor

For detailed instructions on how to run this example, refer to theHow To article.

Running the Sample Code

  1. Update your system and make sure you have the latest versions of all required software:
    sudo apt update&& sudo apt upgrade -ysudo apt install python3 python3-pip git -ysudo pip3 install --upgrade setuptools pip
  2. Install the Cloud4RPi client library:
    sudo pip3 install cloud4rpi
  3. Clone this repository:
    git clone https://github.com/cloud4rpi/cloud4rpi-raspberrypi-python.git&&cd cloud4rpi-raspberrypi-python
  4. Log into your Cloud4RPi account orcreate a new one.
  5. Copyyour device'sDevice Token. If you have no devices, create one on theDevices page and copy itsDevice Token.
  6. Replace the__YOUR_DEVICE_TOKEN__ string in thecontrol.py file with your device token using any text editor (nano,vim,sed or other):
    sed -i's/__YOUR_DEVICE_TOKEN__/replace-this-text-with-your-real-device-token/' control.py
  7. Run thecontrol.py example:
    sudo python3 control.py
  8. Notice that thedevice went online and started sending data.
  9. Go to theControl Panels page and add a new control panel.
  10. Add a newGauge widget and bind it to theCPU Temp variable.
  11. Add a newSwitch widget and bind it to theLED On variable.
  12. Add a newText widget and bind it to theSTATUS variable. Configure different colors for"IDLE","RING" and"BOOM!" strings.
  13. If you haveDS18B20 sensor connected to your Raspberry Pi, add a newChart widget and bind it to theRoom Temp variable.

You can use this control panel to monitor variables and control a logical state on a hardware pin.

See Also

About

Examples of Cloud4RPi client library usage on Raspberry Pi

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp