<INSERT_DESCRIPTION>
Project description
Python SSCMA-Micro
Description
This is a client for the sscma_micro, which is a microcontroller at server for the SSCMA models.
More information about the sscma_micro can be found at here
Usage
Install
pip install python-sscma
from sscma.micro.client import Client, SerialClient
from sscma.micro.device import Device
from sscma.micro.const import *
import serial
import threading
import time
import logging
import signal
import cv2
import base64
import numpy as np
logging.basicConfig(level=logging.DEBUG)
_LOGGER = logging.getLogger(__name__)
def monitor_handler(device, msg):
if "image" in msg:
jpeg_bytes = base64.b64decode(msg["image"])
# Convert the bytes into a numpy array
nparr = np.frombuffer(jpeg_bytes, np.uint8)
# Decode the image array using OpenCV
img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
# Display the image
cv2.imshow('Base64 Image', img)
cv2.waitKey(1)
msg.pop("image")
print(msg)
def on_device_connect(device):
print("device connected")
device.Invoke(-1, False, True)
device.tscore = 70
device.tiou = 70
client = SerialClient("COM83")
def signal_handler(signal, frame):
print("Ctrl+C pressed!")
client.loop_stop()
def main():
signal.signal(signal.SIGINT, signal_handler)
device = Device(client)
device.on_monitor = monitor_handler
device.on_connect = on_device_connect
device.loop_start()
print(device.info)
i = 60
while True:
print(device.wifi)
print(device.mqtt)
print(device.info)
print(device.model)
device.tscore = i
device.tiou = i
i = i + 1
if i > 100:
i = 30
time.sleep(2)
if __name__ == "__main__":
main()
Contributing
If you have any idea or suggestion, please open an issue first.
If you want to contribute code, please fork this repository and submit a pull request.
License
MIT License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python-sscma-0.2.1.tar.gz.
File metadata
- Download URL: python-sscma-0.2.1.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d12362ad5269b6474fc293fa027ae0af492a283c46c98cc9a2825af5eea64da
|
|
| MD5 |
6d30ebf134781eb88815cc8455946481
|
|
| BLAKE2b-256 |
24f9cd048b20c6844aa1957ad581bfa9ff9f33d65187569577aef1f14f932ac9
|
File details
Details for the file python_sscma-0.2.1-py3-none-any.whl.
File metadata
- Download URL: python_sscma-0.2.1-py3-none-any.whl
- Upload date:
- Size: 1.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18bf7804c8606c1e4fb190d8f7501d96dd8114c61746263b69f569a1717d4737
|
|
| MD5 |
50bf6e5243fa30803b2d9706bce45ee5
|
|
| BLAKE2b-256 |
a4de4ad8ca086043963834b0c0977679fd20fdd16425d8ec8c8b63fe8eef56db
|