1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# blink_i2c.py
# laesst die led des i2c (0x10) blinken
from octopus import *
import time
op=octopus_context()
octopus_init(op)
octopus_open(op)
octopus_i2c_init(op)
octopus_i2c_set_bitrate(op,3) # 100khz
octopus_i2c_send_start(op)
octopus_i2c_send_byte(op,0xae,1)
octopus_i2c_send_byte(op,1,1)
octopus_i2c_send_byte(op,0,1)
octopus_i2c_send_byte(op,0x77,1)
octopus_i2c_send_stop(op)
octopus_i2c_send_start(op)
octopus_i2c_send_byte(op,0xae,1)
octopus_i2c_send_byte(op,1,1)
octopus_i2c_send_byte(op,0,1)
octopus_i2c_send_start(op)
octopus_i2c_send_byte(op,0xaf,1)
print octopus_i2c_receive_byte(op,1,1)
octopus_i2c_send_stop(op)
|