Diferència entre revisions de la pàgina «IoT-Vertebrae»
Salta a la navegació
Salta a la cerca
(Es crea la pàgina amb « = Detecció d'adreces I2C a la Raspberry Pi = pi@raspberrypi:~ $ '''i2cdetect -y 1''' 0 1 2 3 4 5 6 7 8 9 a b c d e f 00:...».) |
m (→Python) |
||
Línia 15: | Línia 15: | ||
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux | Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux | ||
Type "help", "copyright", "credits" or "license" for more information. | Type "help", "copyright", "credits" or "license" for more information. | ||
− | >>> import iotv | + | >>> '''import iotv''' |
− | >>> iotv.aversion("0000") | + | >>> iotv.'''aversion'''("0000") |
Analog rib version: 1.0 | Analog rib version: 1.0 | ||
'0000000100000000' | '0000000100000000' | ||
− | >>> iotv.dversion("0000") | + | >>> iotv.'''dversion'''("0000") |
Digital rib version: 1.2 | Digital rib version: 1.2 | ||
'0000000100000010' | '0000000100000010' | ||
− | >>> iotv.getdsetup("0000") | + | >>> iotv.'''getdsetup'''("0000") |
A digital output, B digital input | A digital output, B digital input | ||
'00010010' | '00010010' | ||
− | >>> iotv.getasetup("0000") | + | >>> iotv.'''getasetup'''("0000") |
respA: 0x1, respB: 0x2 | respA: 0x1, respB: 0x2 | ||
A rib is ADC, B rib is DAC. | A rib is ADC, B rib is DAC. | ||
'00010010' | '00010010' | ||
− | >>> iotv.dsetup("0000","ain","aout") | + | >>> iotv.'''dsetup'''("0000","ain","aout") |
ain, aout | ain, aout | ||
Setup has not been changed | Setup has not been changed | ||
False | False | ||
− | >>> iotv.getdsetup("0000") | + | >>> iotv.'''getdsetup'''("0000") |
A digital output, B digital input | A digital output, B digital input | ||
'00010010' | '00010010' | ||
Línia 48: | Línia 48: | ||
A digital output, B digital input | A digital output, B digital input | ||
'00010010' | '00010010' | ||
− | >>> iotv.ain("0000",'a',1) | + | >>> iotv.'''ain'''("0000",'a',1) |
19881 | 19881 | ||
− | >>> iotv.ainv("0000",'a',1) | + | >>> iotv.'''ainv'''("0000",'a',1) |
i2cAddr: 0x10, addrChannel: 0x1 | i2cAddr: 0x10, addrChannel: 0x1 | ||
res: 0x4DAA: 19882 | res: 0x4DAA: 19882 | ||
Línia 60: | Línia 60: | ||
0x4DBE --> 19902 --> 4.95V | 0x4DBE --> 19902 --> 4.95V | ||
19902 | 19902 | ||
− | >>> iotv.aout("0000",'b',2,4095) | + | >>> iotv.'''aout'''("0000",'b',2,4095) |
dacCommand: 0x32 | dacCommand: 0x32 | ||
It has been sent 0xFFF (10.00 volts) to DAC 2 | It has been sent 0xFFF (10.00 volts) to DAC 2 | ||
Línia 76: | Línia 76: | ||
0x4DBB --> 19899 --> 4.95V | 0x4DBB --> 19899 --> 4.95V | ||
19899 | 19899 | ||
− | >>> iotv.din("0000",'b') | + | >>> iotv.'''din'''("0000",'b') |
'00000000' | '00000000' | ||
>>> iotv.din("0000",'b') | >>> iotv.din("0000",'b') | ||
Línia 82: | Línia 82: | ||
>>> iotv.din("0000",'b') | >>> iotv.din("0000",'b') | ||
'00000000' | '00000000' | ||
− | >>> iotv.dout("0000",'a',0x5A) | + | >>> iotv.'''dout'''("0000",'a',0x5A) |
− | >>> iotv.dsetup("0000","aoutpwm","bin") | + | >>> iotv.'''dsetup'''("0000","aoutpwm","bin") |
aoutpwm, bin | aoutpwm, bin | ||
True | True | ||
Línia 89: | Línia 89: | ||
A PWM output, B digital input | A PWM output, B digital input | ||
'00010100' | '00010100' | ||
− | >>> iotv.doutpwm('0000','a',255) | + | >>> iotv.'''doutpwm'''('0000','a',255) |
>>> iotv.doutpwm('0000','a',55) | >>> iotv.doutpwm('0000','a',55) | ||
>>> iotv.doutpwm('0000','a',0) | >>> iotv.doutpwm('0000','a',0) | ||
Línia 98: | Línia 98: | ||
A digital output, B digital input | A digital output, B digital input | ||
'00010010' | '00010010' | ||
− | >>> iotv.doutbit('0000','a',0,1) | + | >>> iotv.'''doutbit'''('0000','a',0,1) |
>>> iotv.doutbit('0000','a',0,0) | >>> iotv.doutbit('0000','a',0,0) | ||
>>> iotv.dsetup("0000","aoutpwm","bin") | >>> iotv.dsetup("0000","aoutpwm","bin") | ||
Línia 106: | Línia 106: | ||
A PWM output, B digital input | A PWM output, B digital input | ||
'00010100' | '00010100' | ||
− | >>> iotv.doutbitpwm('0000','a',0,55) | + | >>> iotv.'''doutbitpwm'''('0000','a',0,55) |
>>> iotv.doutbitpwm('0000','a',0,255) | >>> iotv.doutbitpwm('0000','a',0,255) | ||
>>> iotv.doutbitpwm('0000','a',0,0) | >>> iotv.doutbitpwm('0000','a',0,0) |
Revisió del 23:47, 17 març 2024
Detecció d'adreces I2C a la Raspberry Pi
pi@raspberrypi:~ $ i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- 10: 10 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Python
pi@raspberrypi:~/iot-vertebrae $ python Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import iotv >>> iotv.aversion("0000") Analog rib version: 1.0 '0000000100000000' >>> iotv.dversion("0000") Digital rib version: 1.2 '0000000100000010' >>> iotv.getdsetup("0000") A digital output, B digital input '00010010' >>> iotv.getasetup("0000") respA: 0x1, respB: 0x2 A rib is ADC, B rib is DAC. '00010010' >>> iotv.dsetup("0000","ain","aout") ain, aout Setup has not been changed False >>> iotv.getdsetup("0000") A digital output, B digital input '00010010' >>> iotv.dsetup("0000","ain","bout") ain, bout True >>> iotv.getdsetup("0000") A digital input, B digital output '00100001' >>> iotv.dsetup("0000","aout","bin") aout, bin True >>> iotv.getdsetup("0000") A digital output, B digital input '00010010' >>> iotv.ain("0000",'a',1) 19881 >>> iotv.ainv("0000",'a',1) i2cAddr: 0x10, addrChannel: 0x1 res: 0x4DAA: 19882 0x4DAA --> 19882 --> 4.94V 19882 >>> iotv.ainv("0000",'a',2) i2cAddr: 0x10, addrChannel: 0x21 res: 0x4DBE: 19902 0x4DBE --> 19902 --> 4.95V 19902 >>> iotv.aout("0000",'b',2,4095) dacCommand: 0x32 It has been sent 0xFFF (10.00 volts) to DAC 2 >>> iotv.ainv("0000",'a',2) i2cAddr: 0x10, addrChannel: 0x21 res: 0x6781: 26497 0x6781 --> 26497 --> 9.90V 26497 >>> iotv.aout("0000",'b',2,2047) dacCommand: 0x32 It has been sent 0x7FF (5.00 volts) to DAC 2 >>> iotv.ainv("0000",'a',2) i2cAddr: 0x10, addrChannel: 0x21 res: 0x4DBB: 19899 0x4DBB --> 19899 --> 4.95V 19899 >>> iotv.din("0000",'b') '00000000' >>> iotv.din("0000",'b') '00100100' >>> iotv.din("0000",'b') '00000000' >>> iotv.dout("0000",'a',0x5A) >>> iotv.dsetup("0000","aoutpwm","bin") aoutpwm, bin True >>> iotv.getdsetup("0000") A PWM output, B digital input '00010100' >>> iotv.doutpwm('0000','a',255) >>> iotv.doutpwm('0000','a',55) >>> iotv.doutpwm('0000','a',0) >>> iotv.dsetup("0000","aout","bin") aout, bin True >>> iotv.getdsetup("0000") A digital output, B digital input '00010010' >>> iotv.doutbit('0000','a',0,1) >>> iotv.doutbit('0000','a',0,0) >>> iotv.dsetup("0000","aoutpwm","bin") aoutpwm, bin True >>> iotv.getdsetup("0000") A PWM output, B digital input '00010100' >>> iotv.doutbitpwm('0000','a',0,55) >>> iotv.doutbitpwm('0000','a',0,255) >>> iotv.doutbitpwm('0000','a',0,0) >>> iotv.dsetup("0000","aout","bin") aout, bin True >>> iotv.getdsetup("0000") A digital output, B digital input '00010010' >>> pi@raspberrypi:~/iot-vertebrae $