有朋友讓幫忙調一下畢設的開發,於是寫了這篇。
esp32c3 pwm 小風扇 步進電機 溫溼度 彩燈 還有一個 無源峯鳴器
先是開發環境配置,以 ubuntu 18.04 爲例介紹配置
安裝常用的開發軟件包
sudo apt-get install gcc git wget make libncurses-dev flex bison gperf python python-pip python-setuptools python-serial cmake minicom
sudo apt-get install python3.8 python3-pip
ubuntu 中 ttyUSB0 沒有權限的2種解決方法
1,sudo usermod -a -G dialout $USER
2,sudo vi /etc/udev/rules.d/70-snap.core.rules
KERNEL=="ttyUSB0", GROUP="uucp",MODE="0666"
下載源碼,注意不能下載最新的,有問題
git clone -b release/v4.4 --recursive https://github.com/espressif/esp-idf.git
git submodule update
配置 python3.8
mkdir ~/bin
~/bin$ ln -s /usr/bin/python3.8 python
vi ~.bashrc
export PATH=~/bin:$PATH
cd esp-idf
./install.sh esp32c3
需要能正常聯網,you 懂
正常安裝成功以後,會提示一個
All done! You can now run:
. ./export.sh
每次進行開發前,需要先執行這個,用來初始化開發環境
source ~/esp-idf/export.sh
編譯自帶的 hello_world
cp ~/esp-idf/examples/get-started/hello_world/ . -rf
cd hello_world
idf.py set-target esp32c3 #設置 cpu
idf.py build #編譯
idf.py -p /dev/ttyUSB0 flash #下載
使用 minicom 打開查看 程序運行情況
特別說明:如果你使用 vmware 上 的 ubuntu 18.04 進行開發,需要安裝上 vmtools 否則 usb 識別會有問題。