micropython编程爱好网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 43802|回复: 9

ADCWiPy 类 – 模数转换

[复制链接]

24

主题

24

帖子

2248

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
2248
发表于 2022-1-20 09:59:59 | 显示全部楼层 |阅读模式
ADCWiPy 类 – 模数转换
笔记

此类是 WiPy 的非标准 ADC 实现。它可以像 machine.ADC在 WiPy 上一样简单地使用,但在下面的文档中命名,machine.ADCWiPy以将其与更通用的 machine.ADC类区分开来。

- T$ F( h  U, I( ^- U& ]

用法:

  1. import machine
    " k! n! q- ~# O) B/ C% z9 C
  2. 1 t' N" a7 b' X8 V$ J# M  X
  3. adc = machine.ADC()             # create an ADC object
    / b- V/ S3 g. _
  4. apin = adc.channel(pin='GP3')   # create an analog pin on GP3! f* a- a9 c. X+ Y8 u9 c
  5. val = apin()                    # read an analog value
复制代码

  k+ ~% G9 i' ]& c! ?
& b! S7 L2 y& P7 ^* M- _
+ r1 ^1 M4 _! S% k9 Y
构造函数classmachine.ADCWiPy(id=0, *, bits=12)

创建与给定引脚关联的 ADC 对象。这允许您随后读取该引脚上的模拟值。有关更多信息,请查看 引脚排列和备用功能表。

警告

ADC 引脚输入范围为 0-1.4V(1.8V 是它可以承受的绝对最大值)。当 GP2、GP3、GP4 或 GP5 重新映射到 ADC 模块时,1.8 V 是最大值。如果这些引脚用于数字模式,则允许的最大输入电压为 3.6V。


, Y# o$ V1 g3 N  J1 B9 A! @

$ H  N( [% K- f0 P& m  z: T+ `方法ADCWiPy.channel(id, *, pin)

创建一个模拟引脚。如果仅给出通道 ID,则将选择正确的引脚。或者,只能通过引脚并选择正确的通道。例子:

  1. # all of these are equivalent and enable ADC channel 1 on GP3
    5 n8 r5 s. [$ h3 h. x) J
  2. apin = adc.channel(1)
    , h5 `4 x: u' q. i0 @2 [. [3 [
  3. apin = adc.channel(pin='GP3')6 z( d4 ?+ M* ?9 v4 v
  4. apin = adc.channel(id=1, pin='GP3')
复制代码
# O& w- V3 M' H/ T+ m9 ^  r, A
& ]- ^/ T- c6 {% U0 w, ]

0 a7 V6 Q( p# s& z  WADCWiPy.init()

启用 ADC 模块。

ADCWiPy.deinit()

禁用 ADC 模块。


! Q  S$ d( e' s: }$ B: i3 y8 X

7 y8 M1 T1 t* M/ X" B8 q7 S; r类 ADCChannel — 从内部或外部源读取模拟值

ADC 通道可以连接到 MCU 的内部点或 GPIO 引脚。ADC 通道是使用 ADC.channel 方法创建的。

machine.adcchannel()

读取通道值的快速方法。

adcchannel.value()

读取通道值。

adcchannel.init()

重新初始化(并有效启用)ADC 通道。

adcchannel.deinit()

禁用 ADC 通道。

/ R' G- B. L5 M* z

; p+ l1 g7 ^: M# A+ K
回复

使用道具 举报

0

主题

98

帖子

500

积分

高级会员

Rank: 4

积分
500
发表于 2022-2-17 23:58:30 | 显示全部楼层

-

Completely I share your opinion. In it something is also idea good, agree with you.
http://defloration.gq/
回复

使用道具 举报

0

主题

98

帖子

500

积分

高级会员

Rank: 4

积分
500
发表于 2022-3-25 22:55:02 | 显示全部楼层

-

Has come on a forum and has seen this theme. Allow to help you?
http://defloration.gq/
回复

使用道具 举报

0

主题

10

帖子

170

积分

注册会员

Rank: 2

积分
170
发表于 2022-5-30 13:03:36 | 显示全部楼层

-

I am am excited too with this question. Prompt, where I can read about it?
http://defloration.gq/
回复

使用道具 举报

0

主题

3

帖子

14

积分

新手上路

Rank: 1

积分
14
发表于 2022-6-6 09:08:39 | 显示全部楼层

-

The made you do not turn back. That is made, is made.
回复

使用道具 举报

0

主题

2

帖子

16

积分

新手上路

Rank: 1

积分
16
发表于 2022-11-22 07:50:51 | 显示全部楼层

-

I will know, I thank for the information.
[url=https://proxyspace.seo-hunter.com]俄罗斯联邦最好的移动代理[/url]
回复

使用道具 举报

0

主题

1

帖子

4

积分

新手上路

Rank: 1

积分
4
发表于 2022-11-23 09:11:35 | 显示全部楼层
Has come on a forum and has seen this theme. Allow to help you?; Z) T) z8 H6 h6 P4 _5 c
MLB fans, get cheap cheap baseball jerseys at camisetasbeisboles.com.If you are looking for New York Yankees jerseys, camisetasbeisboles.com is what you are looking for. We have it all here. Get your favorite player baseball jersey, or even get a personalized baseball jersey for yourself or a loved one.
Camisetas Camisetas MLB Nike
回复

使用道具 举报

0

主题

1

帖子

4

积分

新手上路

Rank: 1

积分
4
发表于 2023-2-9 16:54:04 | 显示全部楼层
I am am excited too with this question. Prompt, where I can read about it?
' }9 m5 z4 s) s- RThe American football team aesthetic is increasingly appealing to followers of urban fashion, even making their clothes part of their everyday look. The NFL jerseysyou find here are designed to be part of a casual outfit that you can wear on the street or to the game. Trust our store tiendacamisetasnfl.com for the best collection of American football jerseys and make it your proudest!
https://www.tiendacamisetasnfl.com/
回复

使用道具 举报

0

主题

1

帖子

4

积分

新手上路

Rank: 1

积分
4
发表于 2023-2-20 10:16:01 | 显示全部楼层
The made you do not turn back. That is made, is made.( Z6 X3 E" R9 |! d' {
I currently buy 90% of my NBA jerseys from this store, basketreplicas.com. I got to know it through a friend of mine, of course good things have to be shared, this store supports multiple payment channels. There are many NBA series jerseys in it, and the retro NBA jerseys are also retained. There are also star jerseys inside, such as: James jerseys, Kobe jerseys, Curry jerseys, etc. Don't miss the free shipping event for orders over 99€!
https://www.basketreplicas.com/
回复

使用道具 举报

0

主题

1

帖子

4

积分

新手上路

Rank: 1

积分
4
发表于 2023-2-27 11:40:43 | 显示全部楼层
I will know, I thank for the information.* X; F* J& w! |$ w9 n2 l8 \
Currently I buy 90% of my NBA jerseys from this store nuovemaglienba.it. I got to know it through a friend of mine, of course good things have to be shared, this store supports multiple payment channels. There are many NBA series jerseys in it, and the retro NBA jerseys are also retained. There are also star jerseys inside, such as: James jerseys, Kobe jerseys, Curry jerseys, etc. Don't miss the free shipping event for orders over 99€!
https://www.nuovemaglienba.it/
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|micropython编程爱好网 ( 粤ICP备14010847号-3 ) microPython技术交流 microPython技术交流2

粤公网安备 44030702001224号

GMT+8, 2024-2-23 21:06 , Processed in 0.187200 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表