-
Notifications
You must be signed in to change notification settings - Fork 0
Example
franck403 edited this page Jul 6, 2023
·
5 revisions
You need the last version of python
Install python and pypi first
- Do
pip install raspberry-control
- Create a file named
main.py
- 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
- At first line we import the module
- After in the end of the exemple we set the raspberry username and password to login with ssh
- After we set the start ip and the number of repeat to find it fast and easly
- After we take the start ip and put in rp.raspberrypi().local()
- At rp.config() we set the file name of the running for auto import function
- At
print(test())
andprint(testl())
we call function andprint(test())
will run on the raspberry but theprint(testl())
will run localy
Raspberry_control is made by Geoloup under MIT licence
Raspberry_control is made by Geoloup under MIT licence