| | 14 | |
| | 15 | == PybLITE1.0 動作ログ |
| | 16 | * 既に、MicroPython は実装されており、USBケーブルで、接続し !TeraTerm で開く |
| | 17 | * 2022/11/30 の記録 |
| | 18 | |
| | 19 | {{{ |
| | 20 | MicroPython v1.13 on 2020-09-02; PYBLITEv1.0 with STM32F411RE |
| | 21 | Type "help()" for more information. |
| | 22 | >>> help() |
| | 23 | Welcome to MicroPython! |
| | 24 | |
| | 25 | For online help please visit http://micropython.org/help/. |
| | 26 | |
| | 27 | Quick overview of commands for the board: |
| | 28 | pyb.info() -- print some general information |
| | 29 | pyb.delay(n) -- wait for n milliseconds |
| | 30 | pyb.millis() -- get number of milliseconds since hard reset |
| | 31 | pyb.Switch() -- create a switch object |
| | 32 | Switch methods: (), callback(f) |
| | 33 | pyb.LED(n) -- create an LED object for LED n (n=1,2,3,4) |
| | 34 | LED methods: on(), off(), toggle(), intensity(<n>) |
| | 35 | pyb.Pin(pin) -- get a pin, eg pyb.Pin('X1') |
| | 36 | pyb.Pin(pin, m, [p]) -- get a pin and configure it for IO mode m, pull mode p |
| | 37 | Pin methods: init(..), value([v]), high(), low() |
| | 38 | pyb.ExtInt(pin, m, p, callback) -- create an external interrupt object |
| | 39 | pyb.ADC(pin) -- make an analog object from a pin |
| | 40 | ADC methods: read(), read_timed(buf, freq) |
| | 41 | pyb.DAC(port) -- make a DAC object |
| | 42 | DAC methods: triangle(freq), write(n), write_timed(buf, freq) |
| | 43 | pyb.RTC() -- make an RTC object; methods: datetime([val]) |
| | 44 | pyb.rng() -- get a 30-bit hardware random number |
| | 45 | pyb.Servo(n) -- create Servo object for servo n (n=1,2,3,4) |
| | 46 | Servo methods: calibration(..), angle([x, [t]]), speed([x, [t]]) |
| | 47 | pyb.Accel() -- create an Accelerometer object |
| | 48 | Accelerometer methods: x(), y(), z(), tilt(), filtered_xyz() |
| | 49 | |
| | 50 | Pins are numbered X1-X12, X17-X22, Y1-Y12, or by their MCU name |
| | 51 | Pin IO modes are: pyb.Pin.IN, pyb.Pin.OUT_PP, pyb.Pin.OUT_OD |
| | 52 | Pin pull modes are: pyb.Pin.PULL_NONE, pyb.Pin.PULL_UP, pyb.Pin.PULL_DOWN |
| | 53 | Additional serial bus objects: pyb.I2C(n), pyb.SPI(n), pyb.UART(n) |
| | 54 | |
| | 55 | Control commands: |
| | 56 | CTRL-A -- on a blank line, enter raw REPL mode |
| | 57 | CTRL-B -- on a blank line, enter normal REPL mode |
| | 58 | CTRL-C -- interrupt a running program |
| | 59 | CTRL-D -- on a blank line, do a soft reset of the board |
| | 60 | CTRL-E -- on a blank line, enter paste mode |
| | 61 | |
| | 62 | For further help on a specific object, type help(obj) |
| | 63 | For a list of available modules, type help('modules') |
| | 64 | >>> |
| | 65 | }}} |
| | 66 | |
| | 67 | * モジュール pyb を調べる |
| | 68 | |
| | 69 | {{{ |
| | 70 | >>> import pyb |
| | 71 | >>> pyb.info() |
| | 72 | ID=4b004d00:03513431:34383038 |
| | 73 | S=96000000 |
| | 74 | H=96000000 |
| | 75 | P1=24000000 |
| | 76 | P2=48000000 |
| | 77 | _etext=806d798 |
| | 78 | _sidata=806d7a0 |
| | 79 | _sdata=20000000 |
| | 80 | _edata=2000001c |
| | 81 | _sbss=2000001c |
| | 82 | _ebss=2000627c |
| | 83 | _sstack=2001bff8 |
| | 84 | _estack=2001fff8 |
| | 85 | _ram_start=20000000 |
| | 86 | _heap_start=2000627c |
| | 87 | _heap_end=2001bff8 |
| | 88 | _ram_end=20020000 |
| | 89 | qstr: |
| | 90 | n_pool=1 |
| | 91 | n_qstr=3 |
| | 92 | n_str_data_bytes=28 |
| | 93 | n_total_bytes=124 |
| | 94 | GC: |
| | 95 | 87360 total |
| | 96 | 1616 : 85744 |
| | 97 | 1=26 2=6 m=40 |
| | 98 | LFS free: 41472 bytes |
| | 99 | >>> |
| | 100 | >>> help(pyb.LED) |
| | 101 | object <class 'LED'> is of type type |
| | 102 | on -- <function> |
| | 103 | off -- <function> |
| | 104 | toggle -- <function> |
| | 105 | intensity -- <function> |
| | 106 | >>> |
| | 107 | }}} |
| | 108 | |
| | 109 | * LED を試してみる |
| | 110 | |
| | 111 | {{{ |
| | 112 | >>> red = pyb.LED(1) |
| | 113 | >>> red.on() |
| | 114 | >>> red.toggle() |
| | 115 | >>> grn = pyb.LED(2) |
| | 116 | >>> grn.on() |
| | 117 | >>> grn.toggle() |
| | 118 | >>> ylw = pyb.LED(3) |
| | 119 | >>> ylw.on() |
| | 120 | >>> ylw.toggle() |
| | 121 | >>> blu = pyb.LED(4) |
| | 122 | >>> blu.on() |
| | 123 | >>> blu.toggle() |
| | 124 | >>> |
| | 125 | }}} |
| | 126 | |
| | 127 | [KhoPyboard PyBoard一覧に戻る] |