暂时只支持led,beep, input key, ADC和mpu6050. 程序源码:https://github.com/zwg0106/imx-yocto/tree/master/sources/ebf-demo/scripts/
程序运行依赖的python3 库:
python3-core
python3-logging
python3-misc
python3-json
python3-shell
python3-threading
python3-prompt-toolkit
python3-docopt
python3-pickle
python3-evdev
python3-smbus
运行:
root@hwasin:~# /usr/bin/scripts/ebf-demo/main.py
ebf>
支持config, show和exit命令,可以设置和获取led,beep,input key, mpu6050和adc设置的状态
LED亮:
ebf> config led --All --ON
LED灭:
ebf> config led --All --OFF
LED闪:
ebf> config led --All --BLINK 查看LED状态:
ebf> show led --All
Red : ON - [127/255]
Green : ON - [127/255]
Blue : ON - [127/255] BEEP:
ebf> config beep --On
ebf> config beep --Off Input Key:
ebf> config input --All --Enable
ebf> config input --All --Disable
input Enable之后,按下key或者onoff按键,可以在/var/log/ebf-demo.log里面可以看到如下log:
{/usr/bin/scripts/ebf-demo/threadPoll.py:74} INFO - event at 1691361438.209419, code 116, type 01, val 01
{/usr/bin/scripts/ebf-demo/threadPoll.py:74} INFO - event at 1691361438.349351, code 116, type 01, val 00
{/usr/bin/scripts/ebf-demo/threadPoll.py:74} INFO - event at 1691361440.789492, code 11, type 01, val 01
{/usr/bin/scripts/ebf-demo/threadPoll.py:74} INFO - event at 1691361440.949549, code 11, type 01, val 00 adc:
ebf> show adc
Current Voltage: 1.6520 V mpu6050:
Enable: 卡会定时采集mpu6050的accel和gyro数据,然后通过UDP把数据发到192.168.37.83:5000
ebf> config mpu6050 --Enable
Disable: 停止mpu6050数据采集
ebf> config mpu6050 --Disable ebf> exit
Exiting ebf CLI... CLI支持tab自动命令补全,up和down可以选择历史命令等。
|