Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brianlesko/ethernet
Communicate with an external device using an ethernet cable, in your Python script
https://github.com/brianlesko/ethernet
Last synced: about 20 hours ago
JSON representation
Communicate with an external device using an ethernet cable, in your Python script
- Host: GitHub
- URL: https://github.com/brianlesko/ethernet
- Owner: BrianLesko
- License: mit
- Created: 2023-12-10T22:13:04.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-17T23:16:02.000Z (10 months ago)
- Last Synced: 2024-01-18T06:06:49.929Z (10 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Ethernet Communication in Python
This code implements serial communication with an arduino. It is based on pyserial. Ive been calling it a wrapper around the pyserial library and have created it to match another wrapper for the socket library - used for ethernet communication.
## Dependencies
This code uses the following libraries:
- `socket`: For handling system resources
- `pandas`: For creating a list of class instances
## Usage
In your Python script:
```
IP = 'Your_IP'
PORT = 23
name = 'Your_name'
ethernet = ethernet(name, IP, PORT)
ethernet.connect()
command = 'Your_command'
response = ethernet.send_and_receive(command)
```
## How it Works
The app as follows:
1. The class is initialized with the port IP and a name
2. send_and_receive encodes and sends your message using utf-8 byte encoding
3. the response is decoded automatically
## Repository Structure
```
repository/
├── ethernet.py # the class is in this python file
├── requirements.txt # the python packages needed to run locally
├── .gitignore # includes the local virtual environment named my_env
└── docs/
└── preview.png # preview photo for Github
```
## Topics
```
Python | Ethernet | Communication
External device | decode bytes | communication | custom classes
Self taught coding | Mechanical engineer | Robotics engineer
Brian Lesko | Brian Joseph Lesko
```
╭━━╮╭━━━┳━━┳━━━┳━╮╱╭╮ ╭╮╱╱╭━━━┳━━━┳╮╭━┳━━━╮
┃╭╮┃┃╭━╮┣┫┣┫╭━╮┃┃╰╮┃┃ ┃┃╱╱┃╭━━┫╭━╮┃┃┃╭┫╭━╮┃
┃╰╯╰┫╰━╯┃┃┃┃┃╱┃┃╭╮╰╯┃ ┃┃╱╱┃╰━━┫╰━━┫╰╯╯┃┃╱┃┃
┃╭━╮┃╭╮╭╯┃┃┃╰━╯┃┃╰╮┃┃ ┃┃╱╭┫╭━━┻━━╮┃╭╮┃┃┃╱┃┃
┃╰━╯┃┃┃╰┳┫┣┫╭━╮┃┃╱┃┃┃ ┃╰━╯┃╰━━┫╰━╯┃┃┃╰┫╰━╯┃
╰━━━┻╯╰━┻━━┻╯╱╰┻╯╱╰━╯ ╰━━━┻━━━┻━━━┻╯╰━┻━━━╯
follow all of these or i will kick you