티스토리 뷰
728x90
NanoPi NEO Air - pi4j로 PWM 제어
NanoPi NEO Air는 하나의 PWM만 지원
배선
Java 소스
import com.pi4j.io.gpio.GpioFactory; import com.pi4j.io.gpio.NanoPiNEOAirGpioProvider; import com.pi4j.wiringpi.Gpio; import com.pi4j.wiringpi.SoftPwm; public class SG90PWMMain { private static int PIN_NUMBER = 1; public static void main(String[] args) throws Exception { // //GpioFactory.setDefaultProvider(new RaspiGpioProvider(RaspiPinNumberingScheme.BROADCOM_PIN_NUMBERING)); //GpioFactory.setDefaultProvider(new OrangePiPc2GpioProvider()); GpioFactory.setDefaultProvider(new NanoPiNEOAirGpioProvider()); // initialize wiringPi library, this is needed for PWM Gpio.wiringPiSetup(); // softPwmCreate(int pin, int value, int range) // the range is set like (min=0 ; max=100) SoftPwm.softPwmCreate(PIN_NUMBER, 0, 50); int counter = 0; while (counter < 3) { // fade LED to fully ON for (int i = 0; i <= 100; i++) { // softPwmWrite(int pin, int value) // This updates the PWM value on the given pin. The value is // checked to be in-range and pins // that haven't previously been initialized via softPwmCreate // will be silently ignored. SoftPwm.softPwmWrite(PIN_NUMBER, i); Thread.sleep(25); } // fade LED to fully OFF for (int i = 100; i >= 0; i--) { SoftPwm.softPwmWrite(PIN_NUMBER, i); Thread.sleep(25); } counter++; } } }
실행
# java -cp .:pi4j-core.jar:pi4j-gpio-extension.jar SG90PWMMain
실행 영상
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 지스타2007
- 튜닝쇼 2008
- ffmpeg
- sas2009
- 일본여행
- 동경
- 레이싱모델 익스트림 포토 페스티벌
- BPI-M4
- android
- 송주경
- NDK
- SAS
- Linux
- Delphi
- ubuntu
- KOBA
- flex
- Spring MVC
- Spring
- Xcode
- oracle
- Mac
- JavaScript
- 전예희
- koba2010
- ble
- 서울오토살롱
- Java
- MySQL
- Delphi Tip
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
글 보관함