Diferència entre revisions de la pàgina «Interacció amb SiPy1.0r de pycom»
m |
m |
||
Línia 48: | Línia 48: | ||
[https://docs.pycom.io/firmwareapi/pycom/network/sigfox/ Instruccions de micropython específiques per a SiPy de pycom] | [https://docs.pycom.io/firmwareapi/pycom/network/sigfox/ Instruccions de micropython específiques per a SiPy de pycom] | ||
+ | |||
+ | = I2C = | ||
+ | [https://docs.pycom.io/gitbook/assets/sipy-pinout.png Imatge de la distribució de pins] | ||
+ | |||
+ | SDA: GPIO12 | ||
+ | |||
+ | SCL: GPIO13 | ||
+ | |||
+ | [https://gist.github.com/projetsdiy/f4330be62589ab9b3da1a4eacc6b6b1c gist de github per a fer escaneig de dispositius I2C] | ||
+ | |||
+ | >>> from machine import I2C | ||
+ | >>> i2c = I2C(0, I2C.MASTER, baudrate=100000) | ||
+ | >>> devices = i2c.scan() | ||
+ | >>> len(devices) | ||
+ | 2 | ||
+ | >>> print (devices) | ||
+ | [60, 118] | ||
+ | >>> hex(devices[0]) | ||
+ | '0x3c' | ||
+ | >>> hex(devices[1]) | ||
+ | '0x76' | ||
+ | >>> |
Revisió del 17:12, 26 abr 2020
Després de prémer el botó de reset:
rst:0x1 (POWERON_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT) ets Jun 8 2016 00:22:57 rst:0x10 (RTCWDT_RTC_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0x00 clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:QIO, clock div:2 load:0x3fff9010,len:8 load:0x3fff9018,len:248 load:0x40078000,len:4056 load:0x4009fc00,len:920 entry 0x4009fde4 I (1577) wifi: wifi firmware version: 2a22b2d I (1593) wifi: pp_task_hdl : 3ffd6b74, prio:23, stack:8192 I (1593) wifi: Init lldesc rx mblock:10 I (1593) wifi: Init lldesc rx ampdu len mblock:7 I (1595) wifi: Init lldesc rx ampdu entry mblock:4 I (1600) wifi: sleep disable I (2588) wifi: frc2_timer_task_hdl:3ffdcbc4, prio:22, stack:2048 I (2612) wifi: mode : softAP (24:0a:c4:00:e3:81) MicroPython v1.8.6-493-g99ac80fe on 2017-03-03; SiPy with ESP32 Type "help()" for more information. >>> help() Welcome to MicroPython! For online help please visit http://micropython.org/help/. For further help on a specific object, type help(obj) >>> from network import Sigfox >>> import socket >>> import ubinascii >>> sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1) >>> sigfox.mac() b'p\xb3\xd5I\x99\n\xfcF' >>> sigfox.id() b'\x00M*]' >>> sigfox.pac() b'\x93n\xf7\x10\x01\xc8&\x9d' >>> ubinascii.hexlify(sigfox.mac()) b'70b3d549990afc46' >>> ubinascii.hexlify(sigfox.id()) b'004d2a5d' >>> ubinascii.hexlify(sigfox.pac()) b'936ef71001c8269d' >>>
Instruccions de micropython específiques per a SiPy de pycom
I2C
Imatge de la distribució de pins
SDA: GPIO12
SCL: GPIO13
gist de github per a fer escaneig de dispositius I2C
>>> from machine import I2C >>> i2c = I2C(0, I2C.MASTER, baudrate=100000) >>> devices = i2c.scan() >>> len(devices) 2 >>> print (devices) [60, 118] >>> hex(devices[0]) '0x3c' >>> hex(devices[1]) '0x76' >>>