Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
interfaces:bmp180 [2020/08/17 06:36] – [Micropython] darroninterfaces:bmp180 [2020/08/17 07:23] (current) – [Micropython] darron
Line 53: Line 53:
 print (bmp180.temperature) print (bmp180.temperature)
 26.95987 26.95987
 +</code>
 +
 +Demo (test.py)
 +
 +<code>
 +'''
 +No license.
 +'''
 +
 +from machine import Pin, I2C
 +from bmp180 import BMP180
 +
 +class Test():
 +    '''
 +    No comment
 +    '''
 +
 +    def __init__(self):
 +        self.bus = I2C(scl=Pin(22), sda=Pin(21), freq=100000)
 +        self.bmp180 = BMP180(self.bus)
 +
 +    def print_temp(self):
 +        print (self.bmp180.temperature)
 +</code>
 +
 +Upload
 +
 +<code>
 +mpfshell --nocolor -no ttyUSB0 -c put test.py
 +</code>
 +
 +Run
 +
 +<code>
 +picocom -b 115200 /dev/ttyUSB0
 +picocom v3.1
 +
 +port is        : /dev/ttyUSB0
 +flowcontrol    : none
 +baudrate is    : 115200
 +parity is      : none
 +databits are   : 8
 +stopbits are   : 1
 +escape is      : C-a
 +local echo is  : no
 +noinit is      : no
 +noreset is     : no
 +hangup is      : no
 +nolock is      : no
 +send_cmd is    : sz -vv
 +receive_cmd is : rz -vv -E
 +imap is        :
 +omap is        :
 +emap is        : crcrlf,delbs,
 +logfile is     : none
 +initstring     : none
 +exit_after is  : not set
 +exit is        : no
 +
 +Type [C-a] [C-h] to see available commands
 +Terminal ready
 +>>> import machine
 +>>> machine.reset()
 +ets Jun  8 2016 00:22:57
 +
 +rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
 +configsip: 0, SPIWP:0xee
 +clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
 +mode:DIO, clock div:2
 +load:0x3fff0018,len:4
 +load:0x3fff001c,len:5008
 +ho 0 tail 12 room 4
 +load:0x40078000,len:10600
 +ho 0 tail 12 room 4
 +load:0x40080400,len:5684
 +entry 0x400806bc
 +I (548) cpu_start: Pro cpu up.
 +I (548) cpu_start: Application information:
 +I (548) cpu_start: Compile time:     Aug 16 2020 00:54:20
 +I (551) cpu_start: ELF file SHA256:  0000000000000000...
 +I (557) cpu_start: ESP-IDF:          v3.3.2
 +I (562) cpu_start: Starting app cpu, entry point is 0x40082f30
 +I (552) cpu_start: App cpu up.
 +I (572) heap_init: Initializing. RAM available for dynamic allocation:
 +I (579) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
 +I (585) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
 +I (591) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
 +I (598) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
 +I (604) heap_init: At 3FFCA9E8 len 00015618 (85 KiB): DRAM
 +I (610) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
 +I (616) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
 +I (623) heap_init: At 4009DE28 len 000021D8 (8 KiB): IRAM
 +I (629) cpu_start: Pro cpu start user code
 +I (312) cpu_start: Starting scheduler on PRO CPU.
 +I (0) cpu_start: Starting scheduler on APP CPU.
 +MicroPython v1.12-665-g60f5b941e on 2020-08-16; ESP32 module with ESP32
 +Type "help()" for more information.
 +>>> from test import Test
 +>>> x = Test()
 +>>> x.print_temp()
 +27.09271
 </code> </code>
 === Resources === === Resources ===