개발자/Arduino

Arduino Nano 33 IoT 개발 가이드 1-1 Blink Test

지구빵집 2020. 9. 18. 10:12
반응형

 

여기서는 가장 기본적인 예제 Blink.ino 예제를 테스트한다.

앞 강의에서 환경설정이 끝났다면 다음과 같이 시험한다.

 

간단한 예제를 아두이노 나노 33 IoT에 업로드 해보자. 아두이노 통합개발환경 IDE에서 파일 - 예제 - 01. Basics - Blink.ino 예제를 사용한다. 예제를 불러오고 아두이노에 업로드하여 동작을 확인한다. 아두이노 나노 33 IoT에 'LED_BUILTIN'핀은 D13번 핀이다.

 

blink.ino 소스코드는 아래와 같다.

 


/*
  Blink

  Turns an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://www.arduino.cc/en/Main/Products

  modified 8 May 2014 by Scott Fitzgerald modified 2 Sep 2016 by Arturo Guadalupi
  modified 8 Sep 2016 by Colby Newman
  This example code is in the public domain.
  http://www.arduino.cc/en/Tutorial/Blink
*/

// the setup function runs once when you press reset or power the board
void setup() 
{
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

 

아두이노 입문할 때 시험하는 코드다. 일단 컴파일과 업로드를 완료하면 아래처럼 상태창에 메시지가 표시된다. 

 

스케치는 프로그램 저장 공간 11436 바이트(4%)를 사용. 최대 262144 바이트.
전역 변수는 3508 바이트의 동적 메모리를 사용.
Atmel SMART device 0x10010005 found
Device       : ATSAMD21G18A
Chip ID      : 10010005
Version      : v2.0 [Arduino:XYZ] Apr 19 2019 14:38:48
Address      : 8192
Pages        : 3968
Page Size    : 64 bytes
Total Size   : 248KB
Planes       : 1
Lock Regions : 16
Locked       : none
Security     : false
Boot Flash   : true
BOD          : true
BOR          : true
Arduino      : FAST_CHIP_ERASE
Arduino      : FAST_MULTI_PAGE_WRITE
Arduino      : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
done in 0.833 seconds

Write 11436 bytes to flash (179 pages)

[==========                    ] 35% (64/179 pages)
[=====================         ] 71% (128/179 pages)
[==============================] 100% (179/179 pages)
done in 0.071 seconds

Verify 11436 bytes of flash with checksum.
Verify successful
done in 0.015 seconds
CPU reset.

 

신호 단자에서 3.3/0V로 신호가 나오면서 나노 33 IoT의 주황색 LED가 점멸하는 것을 확인한다. 여기까지 확인하였다면 개발 환경을 성공적으로 완료하였다. 축하한다!

 

 

 

 

이미지 출처: Arduino In-circuit Debugging with PlatformIO - https://medium.com/@manuel.bl/arduino-in-circuit-debugging-with-platformio-9f699da57ddc

 

 

 

 

 

 

 

반응형