728x90
import org.opentutorials.iot.Elevator;
import org.opentutorials.iot.Lighting;
import org.opentutorials.iot.Security;
public class OkJavaGoingHome {
public static void main(String[] args){
String id = "JAVA APT 507";
// Elevator call
Elevator myElevator = new Elevator(id);
myElevator.callForUp(1);
// Security off
Security mySecurity = new Security(id);
mySecurity.off();
//Light on
Lighting hallLamp = new Lighting("JAVA APT 507 / Hall Lamp");
hallLamp.on();
}
}
코드 출처 :
https://gitlab.com/egoing/java-iot
egoing / JAVAn Sample Library · GitLab
GitLab.com
gitlab.com
정말 신기했던 기능들이 몇가지 있었다.
첫번째로 위 사이트에서 .java 파일이 담긴 폴더를 다운로드하고

위의 그림과 같이 src에 폴더 전체를 드래그 엔 드롭 하여 옮겼다.
본문 클래스로 돌아와 내가 필요한 코드의 주소인
org.opentutorials.iot.Elevator 을 입력하니 위 폴더에 접근할 수 있었다.
엄청나게 강력한 기능이다..
위의 경로를 매번 치기 번거로우므로
import 경로 로 표기하여 마지막 이름만 입력할 수 있게 하였다.
Elevator myElevator = ~ 코드를 보면 알 수 있지만
다른 위치에 있는 Elevator이라는 파일 자체가 자료형이 된 것을 알 수 있다.
이로써 간단하게 IoT 시스템을 구현 해 보았다.
728x90
'java study' 카테고리의 다른 글
[Java Study] 입력과 출력 (0) | 2022.06.25 |
---|---|
[Java Study] 인텔리제이(intellij) 디버거 사용하기 (0) | 2022.06.24 |
[Java Study] 데이터 타입의 변환 (Casting) (0) | 2022.06.20 |
[Java Study] 변수의 정의 (0) | 2022.06.19 |
[Java Study] 문자열 replace 함수 (0) | 2022.06.19 |