
| TM1650 | ESP32C3 |
| SCL | GPIO5 |
| SDA | GPIO4 |
- --注意:因使用了sys.wait()所有api需要在协程中使用
- -- 用法实例
- PROJECT = "ESP32C3_TM1650"
- VERSION = "1.0.0"
- _G.sys = require("sys")
- local tm1650 = require "tm1650"
-
-
-
- --==========数码管显示例子===========
- sys.taskInit(function()
- --共阴段码表,0~9的数字
- local NUM_TABLE_AX = {
- [0]=0x3f,[1]=0x06,[2]=0x5b,[3]=0x4f,[4]=0x66,
- [5]=0x6d,[6]=0x7d,[7]=0x07,[8]=0x7f,[9]=0x6f
- };
- tm1650.init(5,4,tm1650.MODE_LED_OUTPUT)
- while 1 do
- for i = tm1650.DIG1, tm1650.DIG4, 1 do
- tm1650.print(i,NUM_TABLE_AX[8])
- sys.wait(500)
- end
- sys.wait(1000)
- for i = tm1650.BRIGHT1, tm1650.BRIGHT8, 1 do
- tm1650.setBright(i)
- sys.wait(500)
- end
- for i = 1, 8, 1 do
- sys.wait(500)
- tm1650.close()
- sys.wait(500)
- tm1650.open()
- end
- sys.wait(2000)
- tm1650.clear()
- end
- end)
-
- sys.run()
