Changes between Version 2 and Version 3 of Tiny2040


Ignore:
Timestamp:
Apr 13, 2024, 3:47:04 PM (8 months ago)
Author:
katta
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Tiny2040

    v2 v3  
    22
    33== Tiny 2040
     4  * 2022/11/01 Amazon ¥1,600.-
    45
    56||[[Image(Tiny2040.png, 200)]]||
    67
    78[KhoPyboard PyBoard一覧に戻る]
     9
     10== Tiny 2040 の動作ログ
     11
     12{{{
     13>>> import sys
     14>>> sys.implementation
     15(name='micropython', version=(1, 19, 0), _machine='Pimoroni Tiny 2040 with RP2040', _mpy=4102)
     16>>> help()
     17Welcome to MicroPython!
     18
     19For online help please visit https://micropython.org/help/.
     20
     21For access to the hardware use the 'machine' module.  RP2 specific commands
     22are in the 'rp2' module.
     23
     24Quick overview of some objects:
     25  machine.Pin(pin) -- get a pin, eg machine.Pin(0)
     26  machine.Pin(pin, m, [p]) -- get a pin and configure it for IO mode m, pull mode p
     27    methods: init(..), value([v]), high(), low(), irq(handler)
     28  machine.ADC(pin) -- make an analog object from a pin
     29    methods: read_u16()
     30  machine.PWM(pin) -- make a PWM object from a pin
     31    methods: deinit(), freq([f]), duty_u16([d]), duty_ns([d])
     32  machine.I2C(id) -- create an I2C object (id=0,1)
     33    methods: readfrom(addr, buf, stop=True), writeto(addr, buf, stop=True)
     34             readfrom_mem(addr, memaddr, arg), writeto_mem(addr, memaddr, arg)
     35  machine.SPI(id, baudrate=1000000) -- create an SPI object (id=0,1)
     36    methods: read(nbytes, write=0x00), write(buf), write_readinto(wr_buf, rd_buf)
     37  machine.Timer(freq, callback) -- create a software timer object
     38    eg: machine.Timer(freq=1, callback=lambda t:print(t))
     39
     40Pins are numbered 0-29, and 26-29 have ADC capabilities
     41Pin IO modes are: Pin.IN, Pin.OUT, Pin.ALT
     42Pin pull modes are: Pin.PULL_UP, Pin.PULL_DOWN
     43
     44Useful control commands:
     45  CTRL-C -- interrupt a running program
     46  CTRL-D -- on a blank line, do a soft reset of the board
     47  CTRL-E -- on a blank line, enter paste mode
     48
     49For further help on a specific object, type help(obj)
     50For a list of available modules, type help('modules')
     51>>>
     52>>> from machine import Pin
     53>>> r = Pin(18, Pin.OUT)
     54>>> g = Pin(19, Pin.OUT)
     55>>> b = Pin(20, Pin.OUT)
     56>>> r,g,b
     57(Pin(18, mode=OUT), Pin(19, mode=OUT), Pin(20, mode=OUT))
     58>>> r.on()
     59>>> g.on()
     60>>> b.on()
     61>>> r.off()
     62>>> g.off()
     63>>> b.off()
     64>>>
     65>>> r.value()
     660
     67>>> g.value()
     680
     69>>> b.value()
     700
     71>>>
     72}}}
     73
     74[KhoPyboard PyBoard一覧に戻る]