embeded/arduino(genuino)2016. 3. 28. 20:04

시리얼 포트 쓰려면 dialout 그룹에 추가해야 하니 추가해주세열?



윈도우용으로 받는 신버전 보다 낮은지 먼가 메뉴가 다르다.

1.6.8 인거 같은데.. 리눅스 용은 버전이 왜 이모양이야? ㄷㄷ


'embeded > arduino(genuino)' 카테고리의 다른 글

아두이노 / avr bootloader  (0) 2016.03.30
arduino i2c 예제  (0) 2016.03.30
아두이노 빌드 프로세스 & c/cpp  (0) 2016.03.28
아두이노 나노 - LED 블링크 예제  (0) 2016.03.27
아두이노 나노 - 시리얼 테스트  (3) 2016.03.27
Posted by 구차니
embeded/arduino(genuino)2016. 3. 28. 11:17


c/cpp 지원함


Can I program the Arduino board in C? 

In fact, you already are; the Arduino language is merely a set of C/C++ functions that can be called from your code. Your sketch undergoes minor changes (e.g. automatic generation of function prototypes) and then is passed directly to a C/C++ compiler (avr-g++). All standard C and C++ constructs supported by avr-g++ should work in Arduino. For more details, see the page on the Arduino build process.

[링크 : https://www.arduino.cc/en/Main/FAQ]



아두이노 켜면 뜨는 sketch 파일은 바로 빌드 되는게 아니라 여러 단계를 거쳐서 빌드 됨

일단 소스를 보면.. 기본골격이 setup() / loop() 인데

아마도... 이런 구조로 변환하려나?


#include "board.h"

#include "wiring.h"

#define F_CPU 16000000


extern void setup();

extern void loop();

int main()

{

setup();

while(1)

{

// main loop

loop();

// event handler - not interrupt

serial_event();

}

} 

[링크 : https://www.arduino.cc/en/Hacking/BuildProcess]

[링크 : https://www.arduino.cc/en/Hacking/Preferences]



+

2016.03.28


빌드 메시지

/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/eightanaloginputs /tmp/build3729038704914021233.tmp/SerialEvent.cpp -o /tmp/build3729038704914021233.tmp/SerialEvent.cpp.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/WInterrupts.c.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/wiring_pulse.c.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/wiring_digital.c.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/wiring_analog.c.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/malloc.c.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/realloc.c.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/wiring.c.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/wiring_shift.c.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/CDC.cpp.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/Stream.cpp.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/main.cpp.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/WMath.cpp.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/HID.cpp.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/WString.cpp.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/HardwareSerial.cpp.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/IPAddress.cpp.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/USBCore.cpp.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/new.cpp.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/Tone.cpp.o

  Using previously compiled: /tmp/build3729038704914021233.tmp/Print.cpp.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/WInterrupts.c.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/wiring_pulse.c.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/wiring_digital.c.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/wiring_analog.c.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/malloc.c.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/realloc.c.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/wiring.c.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/wiring_shift.c.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/CDC.cpp.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/Stream.cpp.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/main.cpp.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/WMath.cpp.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/HID.cpp.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/WString.cpp.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/HardwareSerial.cpp.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/IPAddress.cpp.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/USBCore.cpp.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/new.cpp.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/Tone.cpp.o

/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs /tmp/build3729038704914021233.tmp/core.a /tmp/build3729038704914021233.tmp/Print.cpp.o

/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o /tmp/build3729038704914021233.tmp/SerialEvent.cpp.elf /tmp/build3729038704914021233.tmp/SerialEvent.cpp.o /tmp/build3729038704914021233.tmp/core.a -L/tmp/build3729038704914021233.tmp -lm

/usr/share/arduino/hardware/tools/avr/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/build3729038704914021233.tmp/SerialEvent.cpp.elf /tmp/build3729038704914021233.tmp/SerialEvent.cpp.eep

/usr/share/arduino/hardware/tools/avr/bin/avr-objcopy -O ihex -R .eeprom /tmp/build3729038704914021233.tmp/SerialEvent.cpp.elf /tmp/build3729038704914021233.tmp/SerialEvent.cpp.hex

바이너리 스케치 사이즈: 3,566 바이트 (최대 30,720 바이트) 


$ cat main.cpp.d

/tmp/build3729038704914021233.tmp/main.cpp.o: \

 /usr/share/arduino/hardware/arduino/cores/arduino/main.cpp \

 /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h \

 /usr/share/arduino/hardware/arduino/cores/arduino/binary.h \

 /usr/share/arduino/hardware/arduino/cores/arduino/WCharacter.h \

 /usr/share/arduino/hardware/arduino/cores/arduino/WString.h \

 /usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.h \

 /usr/share/arduino/hardware/arduino/cores/arduino/Stream.h \

 /usr/share/arduino/hardware/arduino/cores/arduino/Print.h \

 /usr/share/arduino/hardware/arduino/cores/arduino/Printable.h \

 /usr/share/arduino/hardware/arduino/cores/arduino/new.h \

 /usr/share/arduino/hardware/arduino/variants/eightanaloginputs/pins_arduino.h \

 /usr/share/arduino/hardware/arduino/variants/eightanaloginputs/../standard/pins_arduino.h 


$ cat /usr/share/arduino/hardware/arduino/cores/arduino/main.cpp

#include <Arduino.h>


int main(void)

{

        init();


#if defined(USBCON)

        USBDevice.attach();

#endif


        setup();


        for (;;) {

                loop();

                if (serialEventRun) serialEventRun();

        }


        return 0;

} 


'embeded > arduino(genuino)' 카테고리의 다른 글

arduino i2c 예제  (0) 2016.03.30
아두이노 on ubuntu 15.10  (0) 2016.03.28
아두이노 나노 - LED 블링크 예제  (0) 2016.03.27
아두이노 나노 - 시리얼 테스트  (3) 2016.03.27
아두이노 나노 v3.0 / v3.1  (0) 2016.03.27
Posted by 구차니
embeded/arduino(genuino)2016. 3. 27. 20:32

기본이 주기 1000 ms로 예제를 주니

100ms로 바꾸려면

const long interval = 1000;

을 

const long interval = 100;

으로 바꾸어 주면되는데...


나노의 겨우 13번 포트가 LED 연결되어 있으니 예제로 쓰긴 좋은데

USB을 뺐다가 꽂으면 왜 불규칙하게 깜박이게 될까?...


+

아두이노 IDE를 끄니 정상작동..

이녀석이 먼가 계속 핸들링 하면서 인터럽트 걸어서 그런가?

+



Posted by 구차니
embeded/arduino(genuino)2016. 3. 27. 20:19

기본 셋팅은 나의 경우에는 아래와 같이

Arduino nano 선택시 cpu는 ATmega328로 자동 선택되었고

포트는 수동으로

프로그래머도 수동으로 선택해주어야 한다.


프로그래머는 avrdude 나 stk500 등을 내장해서 굽는데

USB를 통해서 구울때는 Arduino as ISP로 설정해야 구워지네...

+

2016.04.06

어? 프로그래머 멀로 하던 알아서 굽는 느낌?

avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58

         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         Copyright (c) 2007-2009 Joerg Wunsch


         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"


         Using Port                    : COM6

         Using Programmer              : arduino

         Overriding Baud Rate          : 57600

         AVR Part                      : ATmega328P

         Chip Erase delay              : 9000 us

         PAGEL                         : PD7

         BS2                           : PC2

         RESET disposition             : dedicated

         RETRY pulse                   : SCK

         serial program mode           : yes

         parallel program mode         : yes

         Timeout                       : 200

         StabDelay                     : 100

         CmdexeDelay                   : 25

         SyncLoops                     : 32

         ByteDelay                     : 0

         PollIndex                     : 3

         PollValue                     : 0x53

         Memory Detail                 :


                                  Block Poll               Page                       Polled

           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack

           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------

           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff

           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff

           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00


         Programmer Type : Arduino

         Description     : Arduino

         Hardware Version: 2

         Firmware Version: 1.16

         Vtarget         : 0.0 V

         Varef           : 0.0 V

         Oscillator      : Off

         SCK period      : 0.1 us


avrdude: AVR device initialized and ready to accept instructions


Reading | ################################################## | 100% 0.01s


avrdude: Device signature = 0x1e950f

avrdude: reading input file "C:\Users\shin\AppData\Local\Temp\build56906a4f22bf0a8b9bdb55c318239f30.tmp/sketch_mar27a.ino.hex"

avrdude: writing flash (1796 bytes):


Writing | ################################################## | 100% 1.18s


avrdude: 1796 bytes of flash written

avrdude: verifying flash memory against C:\Users\shin\AppData\Local\Temp\build56906a4f22bf0a8b9bdb55c318239f30.tmp/sketch_mar27a.ino.hex:

avrdude: load data flash data from input file C:\Users\shin\AppData\Local\Temp\build56906a4f22bf0a8b9bdb55c318239f30.tmp/sketch_mar27a.ino.hex:

avrdude: input file C:\Users\shin\AppData\Local\Temp\build56906a4f22bf0a8b9bdb55c318239f30.tmp/sketch_mar27a.ino.hex contains 1796 bytes

avrdude: reading on-chip flash data:


Reading | ################################################## | 100% 1.05s


avrdude: verifying ...

avrdude: 1796 bytes of flash verified


avrdude done.  Thank you. 




상단메뉴 tooltip 캡쳐

시리얼 모니터는 포트로 설정된 쪽에서 열리고, 업로드 시에는 자동으로(?) 꺼지게 된다.



시리얼 포트가 USB를 통해 항상 열리는게 아니기에

시리얼 모니터를 열어야 LED가 깜박이게 된다.


HTML로 복사해서 붙여 넣으니 이쁘네 ㅋㅋ

시리얼에서 무한으로 115k로 열어 Hello World 뿌려주는 예제

\r\n 넣을걸 그랬나?

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  while(1)
  {
    Serial.print("Hello world.");
  }
}



[링크 : http://www.hardcopyworld.com/ngine/aduino/index.php/archives/963]


+

2020.03.27


old bootloader로 하면 잘 된다.

[링크 : https://www.diymaker.net/121]

Posted by 구차니
embeded/arduino(genuino)2016. 3. 27. 19:50


나노 3.0 부터는 Atmega328 이라네..

ATmega328 (Arduino Nano 3.x) or ATmega168 (Arduino Nano 2.x)

[링크 : https://www.arduino.cc/en/Main/ArduinoBoardNano]


심심하니.. 아두이노 IDE나 설치


드라이버 설치 한다고 하니.. 두개가 뜨네



장치 관리자 상으로는

범용 직렬 버스 컨트롤러 - USB Serial Converter

포트(COM & LPT) - USB Serial Port(COMx)

두개만 추가 된다.


FTDI 칩을 쓰니.. 저가형 ISP로 나온 시리얼 포트를 통한 업데이트를 쓰는걸려나?


[링크 : http://www.atmel.com/images/doc0943.pdf]


아두이노 스케치(?) 실행!



좌 나노 3.0

우 나노 3.1


거상인 보드(GS-08A) 와의 비교

전면은 USB 커넥터 하나고

후면은 FTDI 칩(USB) / 레귤레이터 차이 일려나?



Posted by 구차니
embeded/arduino(genuino)2016. 3. 26. 22:45

헐.. 뜯지도 않은거네 ㄷㄷ

2016/03/24 - [개소리 왈왈/직딩의 비애] - po지름wer!!!


아무튼.. 아두이노도 한번 해봐야지

usb만 꽂으면 되는거라고 하니.. 좀더 편할테니..


HS-311 표준 서보


아두이노 nano



'embeded > arduino(genuino)' 카테고리의 다른 글

아두이노 나노 - 시리얼 테스트  (3) 2016.03.27
아두이노 나노 v3.0 / v3.1  (0) 2016.03.27
아두이노 버전별 차이점  (0) 2015.10.05
아두이노 부품들...  (0) 2015.06.29
아두이노 (arduino)  (0) 2011.12.29
Posted by 구차니
embeded/arduino(genuino)2015. 10. 5. 16:52

아두이노 보면 여러가지 버전(?)이라고 해야하나?

보드가 여러가지가 존재하는데


[링크 : https://www.arduino.cc/en/Reference/SPI]


세부적인걸 제외하면

Due만 AT91SAM ARM Cortex-m3 계열이고

나머지는 AVR 계열이다.

[링크 : http://arduinomidi.com/xe/BlogBoard/9489]

'embeded > arduino(genuino)' 카테고리의 다른 글

아두이노 나노 - 시리얼 테스트  (3) 2016.03.27
아두이노 나노 v3.0 / v3.1  (0) 2016.03.27
지름 도착 - 아두이노 나노/표준서보  (0) 2016.03.26
아두이노 부품들...  (0) 2015.06.29
아두이노 (arduino)  (0) 2011.12.29
Posted by 구차니
embeded/arduino(genuino)2015. 6. 29. 17:08

헐.. 다 합치면 한 30만 넘을듯 ㄷㄷㄷㄷ


RFID

[링크 : http://www.seeedstudio.com/depot/Grove-125KHz-RFID-Reader-p-1008.html] 5V / TTL 9600bps

    [링크 : http://www.seeedstudio.com/wiki/Grove_-_125KHz_RFID_Reader]


Ultrasonic Ranger

[링크 : http://www.seeedstudio.com/depot/Grove-Ultrasonic-Ranger-p-960.html] 5V (3.3에도 작동은 함)



    [링크 : http://www.seeedstudio.com/wiki/Ultra_Sonic_range_measurement_module]


Joystick

[링크 : http://www.seeedstudio.com/depot/Grove-Thumb-Joystick-p-935.html] 5V


Chainable LED


1. The ic will latch a bit of data when the rising edge of the clock coming, And the data should changed after the falling edge of the clock;

2. The flag bits is two “1”;

3. The verify dta B7’is equal to ~B7,and B6’1S ~B6,B7 and B6 are the gray data of blue

4. the serial data is MSB first ,and the sortorder is blue ,green, red 


[링크 : http://www.seeedstudio.com/wiki/images/b/be/P9813_datasheet.pdf]

    [링크 : http://www.seeedstudio.com/depot/Grove-Chainable-RGB-LED-p-850.html] 5V 20mA


Relay

[링크 : http://www.seeedstudio.com/depot/Grove-Relay-p-769.html]


Humidity - Temperature Sensor

[링크 : http://www.seeedstudio.com/depot/Grove-TempHumi-Sensor-p-745.html] 3.3~5V


Serial Camera

[링크 : http://www.linksprite.com/upload/file/1291522825.pdf]

[링크 : http://store.cutedigi.com/infrared-jpeg-color-camera-serial-uart-rs232-level/] 5V / TTL 38400bps

    [링크 : http://learn.linksprite.com/.../use-linksprite-jpeg-camera-to-take-picture-and-store-to-a-sd-card/]


PIR Sensor

[링크 : https://cdn.openimpulse.com/.../DYP-ME003_PIR_Sensor_Module_Datasheet.pdf] 5V / output 3.3 high/low

    [링크 : http://www.vetco.net/catalog/product_info.php?products_id=12843]

    [링크 : https://learn.adafruit.com/downloads/pdf/pir-passive-infrared-proximity-motion-sensor.pdf]




bluetooth shield

[링크 : http://www.seeedstudio.com/wiki/Bluetooth_Shield] 3.3V / TTL 38400bps


Mega Shield

[링크 : http://www.seeedstudio.com/depot/Grove-Mega-Shield-p-934.html]

    [링크 : http://www.seeedstudio.com/wiki/Grove_-_Mega_Shield]


Wifi shield

[링크 : https://www.arduino.cc/en/Main/ArduinoWiFiShield]




android board

[링크 : http://www.seeedstudio.com/depot/Seeeduino-ADK-Main-Board-p-846.html]

    [링크 : http://www.seeedstudio.com/wiki/Seeeduino_ADK_Main_Board]




GND / Vcc / Data / Data 식으로 주로 사용하는 듯?


[링크 : http://www.seeedstudio.com/depot/grove-base-shield-p-754.html?cPath=132_134]

Posted by 구차니
embeded/arduino(genuino)2011. 12. 29. 22:33



문득 어디서 주워들은게 있어서 찾아 봤는데
AVR을 기반으로 AVRStudio가 아닌 독자적인 IDE와 API를 제공하는 open source 개발환경이다.
기본적인 보드의 회로까지 공개하고 있는 장점이 있다는데

windows용을 받아보니 프로그램 안에 java가 들어있고,
단순하면서 상당히 깔끔하고 잘만들어져 있다.



아두이노 파일은 확장자는 ino 이며
일반적인 AVRStudio의 문법과는 조금 다르게 구성되어 있다. 


아두이노화(?)된 녀석이다 보니
라이브러리도 범용으로 include를 이런식으로 가능하도록 해놓았는데
처음에는 이게 머야~ 싶긴 하지만 확실히 기계어스러운 AVR 보다는 조금은 더 이해하기 쉬운듯


[링크 : http://www.arduino.cc/]



사족 1. 검색하다 보니 FTDI 드라이버가 내장되어 USB로 연결한다는데
          다른 AVR과는 다르게(?) 보드 자체에 ISP를 내장시키는 타입이다. 
Posted by 구차니