Skip to content

Example

franck403 edited this page Jul 5, 2023 · 5 revisions

Example

first step

First Step

Installation

You need the last version of python

Install python and pypi first

  1. Do pip install raspberry-control
  2. Create a file named main.py
  3. in main.py copy this code
import raspberrypi_control # import package for raspberrypi controlling over ssh  
import os # Put import here they are take and install to the raspberrypi file.  
import time  
  
rp = raspberrypi_control # rp is for RaspBerryPi  
  
i = 1234567890  
  
  
@rp.raspberry_command() # run code and you're raspberrypi. If the raspberrypi was not find it's will be run in local.  
def test():  
    print("Hello RaspBerryPi")  
    return "finished"  

def testl():
    print("Hello world")
    return "finished"


 

  
if __name__ == "__main__": # put all you're code to run at start here. Because if not the code will be run 2 time  
    rp.raspberrypi().set_raspberry_info("username here", "password here") # set login info here
    rp.raspberrypi().set_preparation("192.168.0.10", 9, 1) # config locator for the raspberrypi  
    rp.raspberrypi().local("192.168.0.10") # set the start ip set in the line in the top  
    rp.config("main") # file name if this file (no .py)  
    print(test())
    print(testl())

At login info put the login for the raspberrypi with username and password

At set_preparation and local set correct parm you can try with the default

Explanation of the code

Raspberry_control is made by Geoloup under MIT licence

Clone this wiki locally