/arduino-study

5年遅れのIoT自習

Primary LanguageC++

Arduinoのお勉強

http://kit.socinno.com/ を買ったので

環境構築

  1. /dev/ttyACM0とか/dev/ttyUSB0をsudo無しで開くために・・・
    • sudo gpasswd -a kentac55 uucp
    • sudo gpasswd -a kentac55 lock
  2. ログアウト&ログイン
  3. modprobe
    • sudo modprobe cdc_acm
  4. パッケージ追加
    • sudo pacman -S arduino-cli uucp
    • Fritzingあると便利
  5. 初期設定
    1. 以下を~/.arduino15/arduino-cli.yamlとして保存
      proxy_type: auto
      sketchbook_path: /home/kentac55/src/github.com/kentac55/arduino-study
      arduino_data: /home/kentac55/.arduino15
      board_manager:
        additional_urls:
          - https://dl.espressif.com/dl/package_esp32_index.json
    2. arduino-cli core update-index
    3. arduino-cli core install esp32:esp32

作る

  1. 回路を設計する
    • Fritzing
  2. 回路を実装する
  3. 作成
    • arduino-cli sketch new test
    • cd /home/kentac55/src/github.com/kentac55/arduino-study
    • vim test/test.ino
  4. コンパイル
    • arduino-cli compile --fqbn esp32:esp32:esp32 /test
  5. こういうトラブルがあるので手動でpartition.bin/tmp/arduino-sketch-****から/home/kentac55/src/github.com/kentac55/arduino-study/testにコピーする
    • cp /tmp/arduino-sketch-***/test.ino.partitions.bin ./test/test.esp32.esp32.esp32.partitions.bin
  6. upload
    • arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:esp32 /home/kentac55/src/github.com/kentac55/arduino-study/test