瀏覽代碼

first commit

master
Alex Volkmann 5 年之前
當前提交
b864339813
共有 5 個文件被更改,包括 96 次插入0 次删除
  1. +1
    -0
      .gitignore
  2. +17
    -0
      .project
  3. +11
    -0
      .settings/org.eclipse.jdt.core.prefs
  4. +7
    -0
      README.md
  5. +60
    -0
      src/pdu_jctrl/gpio_java.java

+ 1
- 0
.gitignore 查看文件

@@ -0,0 +1 @@
bin/

+ 17
- 0
.project 查看文件

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>pdu_jctrl</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

+ 11
- 0
.settings/org.eclipse.jdt.core.prefs 查看文件

@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

+ 7
- 0
README.md 查看文件

@@ -0,0 +1,7 @@
# Overview

# Deployment

use the following command to transfer project to raspberry pi:

scp -r gpio pi@192.168.1.77:~

+ 60
- 0
src/pdu_jctrl/gpio_java.java 查看文件

@@ -0,0 +1,60 @@
package pdu_jctrl;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

public class gpio_java
{

public static void main (String [] args)
{
System.out.println("Hello World");
setgpio(true);
try {
TimeUnit.SECONDS.sleep(1);
}
catch(InterruptedException e)
{
System.out.println("sleep error InterruptedException ocure");
}
setgpio(false);
}
public static void launchcmd(String cmd)
{
// Wenn Simulation True ist kann sie auf dem PC ausfuehren
// wenn die Simulation false is auf dem Raspberry PI
boolean simulation = true;
if(simulation==true){
System.out.println(cmd);
}
else {
try{
Runtime.getRuntime().exec(cmd);
}
catch(IOException e)
{
System.out.println("process error IOException");
}
}
}
public static void setgpio(boolean status)
{
launchcmd("/usr/bin/gpio -g mode 14 out");
if(status == true)
{
launchcmd("/usr/bin/gpio -g write 14 1");
}
else
{
launchcmd("/usr/bin/gpio -g write 14 0");
}
}
}

Loading…
取消
儲存