Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.s7connector:s7connector:s7connector-2.0'
	}
	dependencies {
		implementation("com.github.s7connector:s7connector:s7connector-2.0")
	}
	<dependency>
	    <groupId>com.github.s7connector</groupId>
	    <artifactId>s7connector</artifactId>
	    <version>s7connector-2.0</version>
	</dependency>

                            
    libraryDependencies += "com.github.s7connector" % "s7connector" % "s7connector-2.0"
        
        

                            
    :dependencies [[com.github.s7connector/s7connector "s7connector-2.0"]]
        
        

Readme


<p align="center"> <img src="http://s33.postimg.org/fg8gkqfhr/s7connector.png" alt="S7 PLC Connector for Java" width="226"> <br> <a href="https://travis-ci.org/s7connector/s7connector"><img src="https://travis-ci.org/s7connector/s7connector.svg?branch=master" alt="Build Status"></a> </p> <p align="center"><b>S7 PLC Connector for Java</b></p> <p align="center"><img src="http://www.plcdev.com/files/plcdev/images/S7-family.jpg" width=400 height=250 alt="Screenshot of Example Documentation created with Slate"></p>

Features

  • Connect to Siemens S7 PLCs using TCP Connection

  • Reading and Writing data from/to S7 PLCs

  • OSGi Support

  • PROFINET Support

  • Use directly from Maven Central

  • Apache License

Getting Started

Simple read/write example

	//Create connection
    S7Connector connector = 
            S7ConnectorFactory
            .buildTCPConnector()
            .withHost("10.0.0.220")
            .withType(1) //optional
            .withRack(0) //optional
            .withSlot(2) //optional
            .build();
                
	//Read from DB100 10 bytes
	byte[] bs = connector.read(DaveArea.DB, 100, 10, 0);

	//Set some bytes
	bs[0] = 0x00;
		
	//Write to DB100 10 bytes
	connector.write(DaveArea.DB, 101, 0, bs);

	//Close connection
	connector.close();

More in the Documentation

Maven directions

<dependency>
    <groupId>com.github.s7connector</groupId>
    <artifactId>s7connector</artifactId>
    <version>2.1</version>
</dependency>

Need Help? Found a bug?

Feel free to submit an issue. And, of course, feel free to submit pull requests with bug fixes or changes.

Contributors

Pull requests are always welcome. See CONTRIBUTING.md for details.

License

See LICENSE.txt file.

Special Thanks

This project is based on libnodave