Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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
```
 


 

╭━━╮╭━━━┳━━┳━━━┳━╮╱╭╮ ╭╮╱╱╭━━━┳━━━┳╮╭━┳━━━╮
┃╭╮┃┃╭━╮┣┫┣┫╭━╮┃┃╰╮┃┃ ┃┃╱╱┃╭━━┫╭━╮┃┃┃╭┫╭━╮┃
┃╰╯╰┫╰━╯┃┃┃┃┃╱┃┃╭╮╰╯┃ ┃┃╱╱┃╰━━┫╰━━┫╰╯╯┃┃╱┃┃
┃╭━╮┃╭╮╭╯┃┃┃╰━╯┃┃╰╮┃┃ ┃┃╱╭┫╭━━┻━━╮┃╭╮┃┃┃╱┃┃
┃╰━╯┃┃┃╰┳┫┣┫╭━╮┃┃╱┃┃┃ ┃╰━╯┃╰━━┫╰━╯┃┃┃╰┫╰━╯┃
╰━━━┻╯╰━┻━━┻╯╱╰┻╯╱╰━╯ ╰━━━┻━━━┻━━━┻╯╰━┻━━━╯

 

X Logo             GitHub             LinkedIn

follow all of these or i will kick you