Changes between Version 16 and Version 17 of PiBotDev


Ignore:
Timestamp:
Oct 15, 2016, 1:10:17 AM (9 years ago)
Author:
David Albert
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PiBotDev

    v16 v17  
    2828    * A SFTP client used to transfer files between Windows and the Pi Zero. It uses the same connection information used for PuTTY.
    2929    * Bitvise SSH Client also has a built-in SFTP client.
     30
     31* Programming with Oracle jdk.dio
     32   * Sample program DioLed.java:
     33     {{{
     34        import java.io.IOException;
     35        import java.lang.InterruptedException;
     36        import jdk.dio.DeviceManager;
     37        import jdk.dio.gpio.GPIOPin;
     38
     39        public class DioLed {
     40
     41           public static void main(String[] args) throws IOException, InterruptedException {
     42              try (GPIOPin led = DeviceManager.open(23);) { // LED on BCM pin 23
     43                 for (int i = 0; i < 10; i++) {
     44                      led.setValue(i % 2 == 0);
     45                      Thread.sleep(2000);
     46                 }
     47              }
     48           }
     49        }
     50     }}}
     51   * Sample java.policy file:
     52     {{{
     53        // grant all permissions for the DIO framework
     54        grant {
     55           permission jdk.dio.DeviceMgmtPermission "*:*", "open";
     56           permission jdk.dio.gpio.GPIOPinPermission "*:*", "open,setdirection";
     57           permission jdk.dio.gpio.GPIOPortPermission "*:*";
     58           permission jdk.dio.i2cbus.I2CPermission "*:*";
     59           permission jdk.dio.spibus.SPIPermission "*:*";
     60           permission jdk.dio.uart.UARTPermission "*:*";
     61        };
     62     }}}
     63   * Sample dio.properties file (note: pin number is BCM pin number: physical pin 16):
     64     {{{
     65        23 = deviceType: gpio.GPIOPin, pinNumber:23, name:GPIO_USER_1, mode:-1, direction:3
     66     }}}
     67   * Compile: {{{ javac -cp . DioLed.java }}}
     68   * Run (assumes dio.jar is in same directory): {{{
     69        sudo java -Djava.security.policy=./java.policy -classpath .:./dio.jar \
     70             -Djdk.dio.registry=./dio.properties DioLed
     71          }}}