Package for studying python features
Project description
Roboroboland Python Study Package(v 0.0.0.2)
This package is about roboroboland's python study. It includes from basic calculator examples to advanced serial communication multi threading code.
To start
Install Library
To Start, Please install following packages
- pyserial
- numpy
- pandas
General
calculator
- To Start
Write down this code on the top of your source
from rland_py_study import calculator.Calculator()
- class:Calulator
-
variables :
- self._result = 0
-
functions :
- result(self):
- return : self._result
- add(self, num) :
- add 'num' and '_result'
- return : self._result
- sub(self, num) :
- subtract 'num' from '_result'
- return : self._result
- mul(self, num) :
- multiply '_result' by 'num'
- return : self._result
- div(self, num) :
- divide '_result' by 'num'
- return : self._result
- reset(self):
- reset '_result' to zero
- return : None
- result(self):
- Example code
from rland_py_study import *
_cal = calculator.Calculator()
while(1):
_input = str(input("Please insert number and operator\nPresent value : "+str(_cal.result())+"\n(ex. +10 or -10, quit:q, reset:r)\ninput : "))
if _input[0] == '+':
print("Add")
_input=_input[1:]
_cal.add(float(_input))
elif _input[0] == '-':
print("Sub")
_input=_input[1:]
_cal.sub(float(_input))
elif _input[0] == '*':
print("mul")
_input=_input[1:]
_cal.mul(float(_input))
elif _input[0] == '/':
print("Div")
_input=_input[1:]
if(float(_input)==0):
print("can't divided by 0")
else:
_cal.div(float(_input))
elif _input[0] == 'r':
_cal.reset()
print("Calculator is reset")
elif _input[0] == 'q':
exit()
else:
print("Wrong input. Please insert right direction.")
Serial
This library is to use Serial communication with external hardware(ex. RS board, Cube, R drone ...)
basic
- To Start
Write Down this code on the top of your source. Package 'pyserial' must be installed to use it.
from rland_py_study.serial import *
- class:SerialBasic
-
variables :
- self.robot = None
- self.process = None
-
functions :
- port_search(self):
- Search COM port of user's computer and prints their names.
- return : None
- port_open(self, port):
- Try to open port to connect device with computer. If openning process succeed, they will be connected. If openning process failed, port will be closed.
- return : None
- port_search(self):
- If there's a connected device, disconnect it from user's computer.
- return : None
- port_search(self):
- Example
#(will be updated soon)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rland_py_study-0.0.0.2.tar.gz
(17.4 kB
view details)
Built Distribution
File details
Details for the file rland_py_study-0.0.0.2.tar.gz
.
File metadata
- Download URL: rland_py_study-0.0.0.2.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4f81484be10e115026b373c61bc795290cfa70bfe9283d21bdcae689a385c1a |
|
MD5 | ad405a776be953281a1b5c9082f0eed2 |
|
BLAKE2b-256 | 3a6cb6b55011f4ac9ed778ae9edf3f51429a8968195b77a99c7fc1c43b051b18 |
File details
Details for the file rland_py_study-0.0.0.2-py3-none-any.whl
.
File metadata
- Download URL: rland_py_study-0.0.0.2-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dfe2a28e57eb2426742bd05ff02a4de896138d1a9d473c75cd463e76a0098b0 |
|
MD5 | 4f625eaf6399f84d4ae4efe5bee972bf |
|
BLAKE2b-256 | 7b0df283e0f5bbd5036748f91e7b38f66fd44bff8deeb2c61938914dc03791cc |