티스토리 뷰

반응형

 

다른 강의자료는 www.codingnow.co.kr/ 여기를 참고해주세요.!!

 

코딩나우

프로그래밍 교육및 개발의뢰 받습니다.

www.codingnow.co.kr

 

자세한 사항은 동영상을 참고해주세요.

https://youtu.be/9ukZDO_MlVc

 

 

 

 

 

 

https://create.arduino.cc/iot

 

Arduino IoT Cloud

 

create.arduino.cc

아두이노 클라우드 서비스 가입 홈페이지 입니다.

기본 무료 서비스가 제공 됩니다.

 

 

 

강의에 사용되었던 led on/off 소스입니다.

/* 
  Sketch generated by the Arduino IoT Cloud Thing "Untitled"
  https://create.arduino.cc/cloud/things/2740915e-2b7b-464e-bf12-ac8204617aef 

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  bool led;

  Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
  which are called when their values are changed from the Dashboard.
  These functions are generated with the Thing and added at the end of this sketch.
*/

#include "thingProperties.h"

int ledpin = 8;

void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(9600);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  delay(1500); 

  // Defined in thingProperties.h
  initProperties();
  
  pinMode(ledpin,OUTPUT);

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  /*
     The following function allows you to obtain more information
     related to the state of network and IoT Cloud connection and errors
     the higher number the more granular information you’ll get.
     The default is 0 (only errors).
     Maximum is 4
 */
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
}

void loop() {
  ArduinoCloud.update();
  // Your code here 
  
  
}

void onLedChange() {
  // Do something
  Serial.print("led : ");
  Serial.println(led);
  if(led){
    digitalWrite(ledpin,HIGH);
  }else{
    digitalWrite(ledpin,LOW);
  }
}
반응형