Skip to content

Commit ba1541b

Browse files
committed
added examples
1 parent a685984 commit ba1541b

File tree

5 files changed

+142
-69
lines changed

5 files changed

+142
-69
lines changed

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This is easy to install with the following command.
1111
```
1212
curl -sL https://github.com/Seeed-Studio/grove.py/raw/master/install.sh | sudo bash -s -
1313
```
14+
1415
## Installing from PyPI
1516

1617
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
@@ -49,11 +50,22 @@ pi@raspberrypi:~/Seeed_Python_SGP30 $ i2cdetect -y -r 1
4950
5051
```
5152

52-
Next, initialize the sersor object:
53+
## initialize the sersor object:
54+
55+
Initialize the sersor object and config the sersor refresh rate.
5356

5457
```python
5558
import seeed_mlx90640
56-
sensor = seeed_mlx90640.grove_mxl90640()
59+
sensor = seeed_mlx90640.grove_mxl90640()
60+
sensor.SetRefreshRate(0x04)
61+
# 0x00 0.5HZ
62+
# 0x01 1HZ
63+
# 0x02 2HZ
64+
# 0x03 4HZ(recommend for raspberry)
65+
# 0x04 8HZ
66+
# 0x05 16HZ
67+
# 0x06 32HZ
68+
# 0x07 64HZ
5769
```
5870

5971
## Reading from the Sensor
@@ -69,6 +81,21 @@ print(len(Pixel)) #24x32 pixel
6981
print(Pixel)
7082
```
7183

84+
If you're just using the MLX90640 on iic.You can add content that below to the config.txt.
85+
86+
```bash
87+
dtparam=i2c_arm=on,i2c_arm_baudrate=1000000
88+
```
89+
90+
This will give you a framerate of - at most - 32FPS.
91+
92+
and If you have other iic device ,maybe you can add content that below to the config.txt to get the fastest rate recommended for compatibility
93+
94+
```bash
95+
dtparam=i2c_arm=on,i2c_arm_baudrate=400000
96+
```
97+
This will give you a framerate of - at most - 8FPS.
98+
7299
## Contributing
73100

74101
If you have any good suggestions or comments, you can send issues or PR us.

examples/BasicReadings.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33
def main():
44
sensor = seeed_mlx90640.grove_mxl90640()
55
while True:
6-
time.sleep(1)
76
Pixel = [0]*801
87
for i in range(0,801):
9-
Pixel[i] = sensor.getCompensatedPixData(i//32,i%32)
10-
del Pixel[0:33]
11-
print(len(Pixel))
12-
print(Pixel)
8+
Pixel[i] = sensor.GetCompensatedPixData(i//32,i%32)
9+
print(Pixel[i])
1310

1411
if __name__ == '__main__':
1512
main()

examples/MaxRefreshRate.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import seeed_mlx90640
2+
import time
3+
def main():
4+
sensor = seeed_mlx90640.grove_mxl90640()
5+
sensor.SetRefreshRate(0x04)
6+
# 0x00 0.5HZ
7+
# 0x01 1HZ
8+
# 0x02 2HZ
9+
# 0x03 4HZ(recommend for raspberry)
10+
# 0x04 8HZ
11+
# 0x05 16HZ
12+
# 0x06 32HZ
13+
# 0x07 64HZ
14+
while True:
15+
Pixel = [0]*801
16+
for i in range(0,801):
17+
Pixel[i] = sensor.GetCompensatedPixData(i//32,i%32)
18+
print(Pixel[i])
19+
if __name__ == '__main__':
20+
main()

examples/Visualization.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import seeed_mlx90640
2+
import time
3+
def main():
4+
sensor = seeed_mlx90640.grove_mxl90640()
5+
while True:
6+
Pixel = [0]*801
7+
for i in range(0,801):
8+
Pixel[i] = sensor.GetCompensatedPixData(i//32,i%32)
9+
del Pixel[0:33]
10+
print(len(Pixel))
11+
print(Pixel)
12+
if __name__ == '__main__':
13+
main()

0 commit comments

Comments
 (0)