这里我用的版本是这样的:
MicroPython v1.10 on 2019-01-26; PYB Nano V2 with STM32F411CE
Type "help()" for more information.
然后我help了后有发现DAC的部分
Welcome to MicroPython!
For online help please visit http://micropython.org/help/.
Quick overview of commands for the board:
pyb.info() -- print some general information
pyb.delay(n) -- wait for n milliseconds
pyb.millis() -- get number of milliseconds since hard reset
pyb.Switch() -- create a switch object
Switch methods: (), callback(f)
pyb.LED(n) -- create an LED object for LED n (n=1,2,3,4)
LED methods: on(), off(), toggle(), intensity(<n>)
pyb.Pin(pin) -- get a pin, eg pyb.Pin('X1')
pyb.Pin(pin, m, [p]) -- get a pin and configure it for IO mode m, pull mode p
Pin methods: init(..), value([v]), high(), low()
pyb.ExtInt(pin, m, p, callback) -- create an external interrupt object
pyb.ADC(pin) -- make an analog object from a pin
ADC methods: read(), read_timed(buf, freq)
pyb.DAC(port) -- make a DAC object
DAC methods: triangle(freq), write(n), write_timed(buf, freq)
pyb.RTC() -- make an RTC object; methods: datetime([val])
pyb.rng() -- get a 30-bit hardware random number
pyb.Servo(n) -- create Servo object for servo n (n=1,2,3,4)
Servo methods: calibration(..), angle([x, [t]]), speed([x, [t]])
pyb.Accel() -- create an Accelerometer object
Accelerometer methods: x(), y(), z(), tilt(), filtered_xyz()
Pins are numbered X1-X12, X17-X22, Y1-Y12, or by their MCU name
Pin IO modes are: pyb.Pin.IN, pyb.Pin.OUT_PP, pyb.Pin.OUT_OD
Pin pull modes are: pyb.Pin.PULL_NONE, pyb.Pin.PULL_UP, pyb.Pin.PULL_DOWN
Additional serial bus objects: pyb.I2C(n), pyb.SPI(n), pyb.UART(n)
Control commands:
CTRL-A -- on a blank line, enter raw REPL mode
CTRL-B -- on a blank line, enter normal REPL mode
CTRL-C -- interrupt a running program
CTRL-D -- on a blank line, do a soft reset of the board
CTRL-E -- on a blank line, enter paste mode
For further help on a specific object, type help(obj)
For a list of available modules, type help('modules')
但是我进行help(pyb.DAC)D的时候就会出现这样的情况:
>>> help(pyb.DAC)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'DAC'
无法调用,请大佬给我解答下,这个到底是什么原因?
在PYB nano上为什么不能搜索到DAC函数
- shaoziyang
- 帖子: 3967
- 注册时间: 2019年 10月 21日 13:48
Re: 在PYB nano上为什么不能搜索到DAC函数
pyb nano使用的是STM32F411,它没有DAC功能。
pybCN使用的是STM32F405,这个芯片才支持DAC。另外社区的pybL(低功耗系列),也是支持DAC的。
pybCN使用的是STM32F405,这个芯片才支持DAC。另外社区的pybL(低功耗系列),也是支持DAC的。
-
- 随机主题
- 回复总数
- 阅读次数
- 最新文章
-
- 1回复总数
- 599 阅读次数
- 最新文章 由 shaoziyang
2023年 3月 13日 09:46
-
- 1回复总数
- 671 阅读次数
- 最新文章 由 shaoziyang
2023年 3月 13日 17:31
-
- 1回复总数
- 718 阅读次数
- 最新文章 由 shaoziyang
2023年 3月 13日 17:39