本文整理匯總了Java中com.pi4j.io.gpio.RaspiPin.GPIO_03屬性的典型用法代碼示例。如果您正苦於以下問題:Java RaspiPin.GPIO_03屬性的具體用法?Java RaspiPin.GPIO_03怎麽用?Java RaspiPin.GPIO_03使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.pi4j.io.gpio.RaspiPin
的用法示例。
在下文中一共展示了RaspiPin.GPIO_03屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPinForNumber
private Pin getPinForNumber(int number) {
switch (number) {
case 0:
return RaspiPin.GPIO_00;
case 1:
return RaspiPin.GPIO_01;
case 2:
return RaspiPin.GPIO_02;
case 3:
return RaspiPin.GPIO_03;
case 4:
return RaspiPin.GPIO_04;
case 5:
return RaspiPin.GPIO_05;
case 6:
return RaspiPin.GPIO_06;
case 7:
return RaspiPin.GPIO_07;
case 8:
return RaspiPin.GPIO_08;
case 9:
return RaspiPin.GPIO_09;
case 10:
return RaspiPin.GPIO_10;
case 11:
return RaspiPin.GPIO_11;
case 12:
return RaspiPin.GPIO_12;
case 13:
return RaspiPin.GPIO_13;
case 14:
return RaspiPin.GPIO_14;
case 15:
return RaspiPin.GPIO_15;
case 16:
return RaspiPin.GPIO_16;
case 17:
return RaspiPin.GPIO_17;
case 18:
return RaspiPin.GPIO_18;
case 19:
return RaspiPin.GPIO_19;
case 20:
return RaspiPin.GPIO_20;
}
return null;
}
示例2: getPin
/**
* Get a GPIO pin from an integer
*
* @param theStatusPin integer representation of the pin
* @return
*/
public static Pin getPin(int theStatusPin)
{
Pin aPin = RaspiPin.GPIO_02;
switch (theStatusPin)
{
case 0:
aPin = RaspiPin.GPIO_00;
break;
case 1:
aPin = RaspiPin.GPIO_01;
break;
case 2:
aPin = RaspiPin.GPIO_02;
break;
case 3:
aPin = RaspiPin.GPIO_03;
break;
case 4:
aPin = RaspiPin.GPIO_04;
break;
case 5:
aPin = RaspiPin.GPIO_05;
break;
case 6:
aPin = RaspiPin.GPIO_06;
break;
case 7:
aPin = RaspiPin.GPIO_07;
break;
case 8:
aPin = RaspiPin.GPIO_08;
break;
case 9:
aPin = RaspiPin.GPIO_09;
break;
case 10:
aPin = RaspiPin.GPIO_10;
break;
case 11:
aPin = RaspiPin.GPIO_11;
break;
case 12:
aPin = RaspiPin.GPIO_12;
break;
case 13:
aPin = RaspiPin.GPIO_13;
break;
case 14:
aPin = RaspiPin.GPIO_14;
break;
case 15:
aPin = RaspiPin.GPIO_15;
break;
case 16:
aPin = RaspiPin.GPIO_16;
break;
case 17:
aPin = RaspiPin.GPIO_17;
break;
case 18:
aPin = RaspiPin.GPIO_18;
break;
case 19:
aPin = RaspiPin.GPIO_19;
break;
case 20:
aPin = RaspiPin.GPIO_20;
break;
}
return aPin;
}
示例3: getPinInstance
Pin getPinInstance(){
Pin result = null;
switch(config.getPinNumber().intValue()){
case 0:
result = RaspiPin.GPIO_00;
break;
case 1:
result = RaspiPin.GPIO_01;
break;
case 2:
result = RaspiPin.GPIO_02;
break;
case 3:
result = RaspiPin.GPIO_03;
break;
case 4:
result = RaspiPin.GPIO_04;
break;
case 5:
result = RaspiPin.GPIO_05;
break;
case 6:
result = RaspiPin.GPIO_06;
break;
case 7:
result = RaspiPin.GPIO_07;
break;
case 8:
result = RaspiPin.GPIO_08;
break;
case 9:
result = RaspiPin.GPIO_09;
break;
case 10:
result = RaspiPin.GPIO_10;
break;
case 11:
result = RaspiPin.GPIO_11;
break;
case 12:
result = RaspiPin.GPIO_12;
break;
case 13:
result = RaspiPin.GPIO_13;
break;
case 14:
result = RaspiPin.GPIO_14;
break;
case 15:
result = RaspiPin.GPIO_15;
break;
case 16:
result = RaspiPin.GPIO_16;
break;
case 17:
result = RaspiPin.GPIO_17;
break;
case 18:
result = RaspiPin.GPIO_18;
break;
case 19:
result = RaspiPin.GPIO_19;
break;
case 20:
result = RaspiPin.GPIO_20;
break;
}
return result;
}
示例4: getPinoMapeado
private Pin getPinoMapeado(Integer endereco) {
switch(endereco.intValue()){
case 0:
return RaspiPin.GPIO_00;
case 1:
return RaspiPin.GPIO_01;
case 2:
return RaspiPin.GPIO_02;
case 3:
return RaspiPin.GPIO_03;
case 4:
return RaspiPin.GPIO_04;
case 5:
return RaspiPin.GPIO_05;
case 6:
return RaspiPin.GPIO_06;
case 7:
return RaspiPin.GPIO_07;
case 8:
return RaspiPin.GPIO_08;
case 9:
return RaspiPin.GPIO_09;
case 10:
return RaspiPin.GPIO_10;
case 11:
return RaspiPin.GPIO_11;
case 12:
return RaspiPin.GPIO_12;
case 13:
return RaspiPin.GPIO_13;
case 14:
return RaspiPin.GPIO_14;
case 15:
return RaspiPin.GPIO_15;
case 16:
return RaspiPin.GPIO_16;
case 17:
return RaspiPin.GPIO_17;
case 18:
return RaspiPin.GPIO_18;
case 19:
return RaspiPin.GPIO_19;
case 20:
return RaspiPin.GPIO_20;
default:
throw new IllegalArgumentException("endereco inexistente.");
}
}
示例5: main
public static void main(String args[]) throws InterruptedException {
System.out.println("GPIO 4 bit LCD example program");
final GpioController gpio = GpioFactory.getInstance();
// initialize LCD
final GpioLcdDisplay lcd = new GpioLcdDisplay(LCD_ROWS, // number of row
// supported by
// LCD
LCD_COLUMNS, // number of columns supported by LCD
RaspiPin.GPIO_11, // LCD RS pin
RaspiPin.GPIO_10, // LCD strobe pin
RaspiPin.GPIO_00, // LCD data bit 1
RaspiPin.GPIO_01, // LCD data bit 2
RaspiPin.GPIO_02, // LCD data bit 3
RaspiPin.GPIO_03); // LCD data bit 4
// clear LCD
lcd.clear();
Thread.sleep(1000);
// write line 1 to LCD
lcd.write(LCD_ROW_1, "- RPi LCD Java -");
// write line 2 to LCD
lcd.write(LCD_ROW_2, "github/iscalik");
Thread.sleep(3000);
// line data replacement
for (int index = 0; index < 5; index++) {
lcd.write(LCD_ROW_2, "----------------");
Thread.sleep(500);
lcd.write(LCD_ROW_2, "****************");
Thread.sleep(500);
}
lcd.write(LCD_ROW_2, "----------------");
// single character data replacement
for (int index = 0; index < lcd.getColumnCount(); index++) {
lcd.write(LCD_ROW_2, index, ">");
if (index > 0)
lcd.write(LCD_ROW_2, index - 1, "-");
Thread.sleep(300);
}
for (int index = lcd.getColumnCount() - 1; index >= 0; index--) {
lcd.write(LCD_ROW_2, index, "<");
if (index < lcd.getColumnCount() - 1)
lcd.write(LCD_ROW_2, index + 1, "-");
Thread.sleep(300);
}
// left alignment, full line data
lcd.write(LCD_ROW_2, "----------------");
Thread.sleep(500);
lcd.writeln(LCD_ROW_2, "<< LEFT");
Thread.sleep(1000);
// right alignment, full line data
lcd.write(LCD_ROW_2, "----------------");
Thread.sleep(500);
lcd.writeln(LCD_ROW_2, "RIGHT >>", LCDTextAlignment.ALIGN_RIGHT);
Thread.sleep(1000);
// center alignment, full line data
lcd.write(LCD_ROW_2, "----------------");
Thread.sleep(500);
lcd.writeln(LCD_ROW_2, "<< CENTER >>", LCDTextAlignment.ALIGN_CENTER);
Thread.sleep(1000);
// mixed alignments, partial line data
lcd.write(LCD_ROW_2, "----------------");
Thread.sleep(500);
lcd.write(LCD_ROW_2, "<L>", LCDTextAlignment.ALIGN_LEFT);
lcd.write(LCD_ROW_2, "<R>", LCDTextAlignment.ALIGN_RIGHT);
lcd.write(LCD_ROW_2, "CC", LCDTextAlignment.ALIGN_CENTER);
Thread.sleep(1000);
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
// update time
while (true) {
// write time to line 2 on LCD
lcd.writeln(LCD_ROW_2, formatter.format(new Date()),
LCDTextAlignment.ALIGN_CENTER);
Thread.sleep(1000);
}
}
示例6: getGpioPinFor
/**
* Get GPIO pin number for a specific wire.
*
* @param param
* Param name
* @param defaultPin
* Default pin if not found in file
* @return Raspi pin of this param
*/
public Pin getGpioPinFor(String param, Pin defaultPin) {
Pin pin = defaultPin;
int pinNumber = getIntProperties(param, -1);
if (pinNumber != -1) {
switch (pinNumber) {
case 0:
pin = RaspiPin.GPIO_00;
break;
case 1:
pin = RaspiPin.GPIO_01;
break;
case 2:
pin = RaspiPin.GPIO_02;
break;
case 3:
pin = RaspiPin.GPIO_03;
break;
case 4:
pin = RaspiPin.GPIO_04;
break;
case 5:
pin = RaspiPin.GPIO_05;
break;
case 6:
pin = RaspiPin.GPIO_06;
break;
case 7:
pin = RaspiPin.GPIO_07;
break;
case 8:
pin = RaspiPin.GPIO_08;
break;
case 9:
pin = RaspiPin.GPIO_09;
break;
case 10:
pin = RaspiPin.GPIO_10;
break;
case 11:
pin = RaspiPin.GPIO_11;
break;
case 12:
pin = RaspiPin.GPIO_12;
break;
case 13:
pin = RaspiPin.GPIO_13;
break;
case 14:
pin = RaspiPin.GPIO_14;
break;
case 15:
pin = RaspiPin.GPIO_15;
break;
case 16:
pin = RaspiPin.GPIO_16;
break;
case 17:
pin = RaspiPin.GPIO_17;
break;
case 18:
pin = RaspiPin.GPIO_18;
break;
case 19:
pin = RaspiPin.GPIO_19;
break;
case 20:
pin = RaspiPin.GPIO_20;
break;
}
}
return pin;
}