本文整理汇总了Java中com.pi4j.io.gpio.GpioPinDigitalMultipurpose类的典型用法代码示例。如果您正苦于以下问题:Java GpioPinDigitalMultipurpose类的具体用法?Java GpioPinDigitalMultipurpose怎么用?Java GpioPinDigitalMultipurpose使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GpioPinDigitalMultipurpose类属于com.pi4j.io.gpio包,在下文中一共展示了GpioPinDigitalMultipurpose类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: digitalWrite
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
public static final void digitalWrite(int pinNum, boolean value) {
GpioPinDigitalMultipurpose pin = pins[pinNum-1];
if (pin == null) {
pinMode(pinNum,value ? OUTPUT_HIGH : OUTPUT_LOW);
} else {
if (value) {
pin.high();
} else {
pin.low();
}
}
}
开发者ID:wmacevoy,项目名称:kiss,代码行数:13,代码来源:GPIO.java
示例2: digitalRead
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
public static final boolean digitalRead(int pinNum) {
GpioPinDigitalMultipurpose pin = pins[pinNum-1];
if (pin == null) {
pinMode(pinNum,INPUT);
return pins[pinNum-1].getState().isHigh();
} else {
return pin.getState().isHigh();
}
}
开发者ID:wmacevoy,项目名称:kiss,代码行数:10,代码来源:GPIO.java
示例3: setUp
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
@Before
public void setUp(){
PowerMockito.mockStatic(Gpio.class);
PowerMockito.mockStatic(TimeUnit.class);
mocked_ADC_CS = mock(GpioPinDigitalOutput.class);
mocked_ADC_CLK = mock(GpioPinDigitalOutput.class);
mocked_ADC_DIO = mock(GpioPinDigitalMultipurpose.class);
sketch = new Ex02_LinearHall(mocked_gpioController);
}
开发者ID:marcandreuf,项目名称:sunfounder-sensors-raspi-4j,代码行数:11,代码来源:Ex02_LinearHallTest.java
示例4: setUp
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
@Before
@Category(FastTest.class)
public void setUp(){
PowerMockito.mockStatic(Gpio.class);
PowerMockito.mockStatic(TimeUnit.class);
mocked_ADC_CS = mock(GpioPinDigitalOutput.class);
mocked_ADC_CLK = mock(GpioPinDigitalOutput.class);
mocked_ADC_DIO = mock(GpioPinDigitalMultipurpose.class);
sketch = new Ex02_03_LinearHall(mocked_gpioController);
}
开发者ID:marcandreuf,项目名称:sunfounder-sensors-raspi-4j,代码行数:12,代码来源:Ex02_03_LinearHallTest.java
示例5: initialize
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
@Before
public void initialize() {
mExecutor = new ExecutorForTesting();
int[] mapping = new int[]{4};
mGpioController = mock(GpioController.class);
mPin = mock(GpioPinDigitalMultipurpose.class);
when(mGpioController.provisionDigitalMultipurposePin(any(Pin.class), any(PinMode.class)))
.thenReturn(mPin);
mPhotoCellController =
new PhotoCellControllerImpl(mapping, mGpioController, mExecutor, 0 /* Don't sleep */);
}
开发者ID:shaeberling,项目名称:winston,代码行数:13,代码来源:PhotoCellControllerImplTest.java
示例6: main
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
public static void main(String args[]) throws InterruptedException {
System.out.println("<--Pi4J--> GPIO Multipurpose Pin Example ... started.");
// create gpio controller
final GpioController gpio = GpioFactory.getInstance();
// provision gpio pin #02 as an multi-purpose pin configured as an input
// pin by default with its internal pull down resistor enabled
final GpioPinDigitalMultipurpose pin = gpio.provisionDigitalMultipurposePin(RaspiPin.GPIO_02, PinMode.DIGITAL_INPUT, PinPullResistance.PULL_DOWN);
// create and register gpio pin listener
pin.addListener(new GpioPinListenerDigital() {
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
// display pin state on console
System.out.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = " + event.getState());
}
});
System.out.println(" ... complete the GPIO #02 circuit and see the listener feedback here in the console.");
// keep program running until user aborts (CTRL-C)
while(true){
Thread.sleep(5000);
// here we want to control the multi-purpose GPIO pin
// so we must reconfigure the pin mode first
pin.setMode(PinMode.DIGITAL_OUTPUT);
// perform the pin output operation
System.out.println(" --> GPIO PIN - RECONFIGURED AS OUPUT PIN");
pin.pulse(1000, true);
// reconfigure the pin back to an input pin
pin.setMode(PinMode.DIGITAL_INPUT);
System.out.println(" --> GPIO PIN - RECONFIGURED AS INPUT PIN");
}
// stop all GPIO activity/threads by shutting down the GPIO controller
// (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks)
// gpio.shutdown(); <--- implement this method call if you wish to terminate the Pi4J GPIO controller
}
开发者ID:uwigem,项目名称:uwigem2017,代码行数:44,代码来源:MultipurposePinGpioExample.java
示例7: provisionDigitalMultipurposePin
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
@Override
public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(GpioProvider provider, Pin pin, String name, PinMode mode) {
return delegate.provisionDigitalMultipurposePin(provider, pin, name, mode);
}
开发者ID:fustinoni-net,项目名称:PiRobotPlatform,代码行数:5,代码来源:BaseRobot.java
示例8: main
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
public static void main(String args[]) throws InterruptedException {
System.out.println("<--Pi4J--> GPIO Multipurpose Pin Example ... started.");
// create gpio controller
final GpioController gpio = GpioFactory.getInstance();
// provision gpio pin #02 as an multi-purpose pin configured as an input
// pin by default with its internal pull down resistor enabled
final GpioPinDigitalMultipurpose pin = gpio.provisionDigitalMultipurposePin(RaspiPin.GPIO_02, PinMode.DIGITAL_INPUT, PinPullResistance.PULL_DOWN);
// create and register gpio pin listener
pin.addListener(new GpioPinListenerDigital() {
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
// display pin state on console
System.out.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = " + event.getState());
}
});
System.out.println(" ... complete the GPIO #02 circuit and see the listener feedback here in the console.");
// keep program running until user aborts (CTRL-C)
for (;;) {
Thread.sleep(5000);
// here we want to control the multi-purpose GPIO pin
// so we must reconfigure the pin mode first
pin.setMode(PinMode.DIGITAL_OUTPUT);
// perform the pin output operation
System.out.println(" --> GPIO PIN - RECONFIGURED AS OUPUT PIN");
pin.pulse(1000, true);
// reconfigure the pin back to an input pin
pin.setMode(PinMode.DIGITAL_INPUT);
System.out.println(" --> GPIO PIN - RECONFIGURED AS INPUT PIN");
}
// stop all GPIO activity/threads by shutting down the GPIO controller
// (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks)
// gpio.shutdown(); <--- implement this method call if you wish to terminate the Pi4J GPIO controller
}
开发者ID:iot-labs,项目名称:communication,代码行数:44,代码来源:MultipurposePinGpioExample.java
示例9: setGpioPin
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
public void setGpioPin(GpioPinDigitalMultipurpose b) {
gpioPin = b;
}
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:4,代码来源:PinDefinition.java
示例10: getGpioPin
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
public GpioPinDigitalMultipurpose getGpioPin() {
return gpioPin;
}
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:4,代码来源:PinDefinition.java
示例11: testGPIOOutput
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
public void testGPIOOutput() {
GpioPinDigitalMultipurpose pin = gpio.provisionDigitalMultipurposePin(RaspiPin.GPIO_02, PinMode.DIGITAL_INPUT, PinPullResistance.PULL_DOWN);
log.info("Pin: {}", pin);
}
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:5,代码来源:RasPi.java
示例12: provisionDigitalMultipurposePin
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(GpioProvider provider, Pin pin, String name, PinMode mode,
PinPullResistance resistance) {
return gpioController.provisionDigitalMultipurposePin(provider, pin, name, mode, resistance);
}
开发者ID:PoJD,项目名称:hawa,代码行数:5,代码来源:GpioImpl.java
示例13: provisionDigitalMultipurposePin
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
@Override
public GpioPinDigitalMultipurpose provisionDigitalMultipurposePin(GpioProvider provider, Pin pin, String name, PinMode mode,
PinPullResistance resistance) {
return null;
}
开发者ID:PoJD,项目名称:hawa,代码行数:6,代码来源:MockGpio.java
示例14: testGPIOOutput
import com.pi4j.io.gpio.GpioPinDigitalMultipurpose; //导入依赖的package包/类
public void testGPIOOutput() {
GpioPinDigitalMultipurpose pin = gpio.provisionDigitalMultipurposePin(RaspiPin.GPIO_02, PinMode.DIGITAL_INPUT, PinPullResistance.PULL_DOWN);
}
开发者ID:glaudiston,项目名称:project-bianca,代码行数:5,代码来源:RasPi.java
注:本文中的com.pi4j.io.gpio.GpioPinDigitalMultipurpose类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论