menuconfig
make menuconfig
Serial flasher config 可以设置Flash size
Partition Table (Custom partition table CSV) 设置app的分区大点
Component config --> Common ESP-related --->可以关掉看门狗 [ ] Interrupt watchdog
[ ] Initialize Task Watchdog Timer on startup
Component config --> Bluetooth --->一些蓝牙的设置,可以让include的文件回来。
from machine import Pin
cols = [4,0]
rows = [2,15]
def m_setup():
for c in cols:
Pin(c, mode=Pin.IN, pull=Pin.PULL_UP)
for r in rows:
Pin(r,mode=Pin.OUT)
Pin(r).value(0)
def loop():
for r in rows:
Pin(r).value(0)
for c in cols:
if Pin(c).value()==0:
print("r:%s ,c:%s",r,c)
Pin(r).value(1)
if __name__ == '__main__':
m_setup()
while 1:
loop()
void scan_matrix(void) {
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
gpio_set_level(MATRIX_ROWS_PINS[row], 0);
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
curState = gpio_get_level(MATRIX_COLS_PINS[col]);
if (PREV_MATRIX_STATE[row][col] != curState) {
DEBOUNCE_MATRIX[row][col] = millis();
}
PREV_MATRIX_STATE[row][col] = curState;
if ((millis() - DEBOUNCE_MATRIX[row][col]) > DEBOUNCE) {
if (MATRIX_STATE[row][col] != curState) {
MATRIX_STATE[row][col] = curState;
}
}
}
gpio_set_level(MATRIX_ROWS_PINS[row], 1);
}
更新esp-idf 直接删除$HOME/esp/esp-idf 再 git clone --recursive https://github.com/espressif/esp-idf.git 再
修改 $HOME/.profile 来改变环境变量
menuconfig make menuconfig Serial flasher config 可以设置Flash size Partition Table (Custom partition table CSV) 设置app的分区大点 Component config --> Common ESP-related --->可以关掉看门狗 [ ] Interrupt watchdog [ ] Initialize Task Watchdog Timer on startup Component config --> Bluetooth --->一些蓝牙的设置,可以让include的文件回来。
esp32引脚
有些io会在启动和reset的时候输出pwm,用这些io输出的时候要注意 GPIO 1 GPIO 3 GPIO 5 GPIO 14 GPIO 15
参考连接方式 cols 12 33 25 26 27 14 32 rows 19 23 18 2 16