Skip to content

Links17/read-modbus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Modbus Data Reader with Image Capture

This Go program sets up an HTTP server that reads Modbus data and captures an image based on certain conditions. It then generates a JSON response containing the image data, area, and coordinates.

Usage

  1. Ensure you have Go installed on your system.
  2. Install the required dependencies by running:
    go get github.com/disintegration/imaging
    go get github.com/goburrow/modbus
    
  3. Run the program by executing:
    go run main.go
    
  4. Access the server at http://localhost:2005/read-modbus to trigger Modbus data reading and image capture.

Endpoints

  • GET /read-modbus: Triggers the Modbus data reading and image capture process. Returns a JSON response containing the captured image data, area, and coordinates.

Dependencies

How It Works

  1. The program establishes a Modbus RTU connection and reads various Modbus registers.
  2. If the specified time interval has passed, the program triggers image capture through Modbus commands.
  3. The captured image is processed and a bounding box is drawn around a specified area.
  4. The resulting image data, area value, and coordinates are returned in a JSON response.

Note

  • Make sure to configure the Modbus connection parameters and Modbus register addresses according to your setup.
  • Adjust the image processing and drawing logic as needed for your application.

Feel free to explore and modify the code according to your requirements. If you encounter any issues or have any questions, please let me know.

About

read-modbus

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published