Skip to content

Commit 5641b26

Browse files
authored
Merge pull request #9 from Seeed-Studio/seeed_python_rpi
Seeed python rpi
2 parents 66a6132 + 7b4e58e commit 5641b26

22 files changed

+378
-227
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
# Python Library for reTerminal
1+
# Python library for Seeed RPi board
22

3-
This is a Python library which enables you to use the onboard hardware on the [reTerminal](https://www.seeedstudio.com/ReTerminal-with-CM4-p-4904.html) and [reTerminal Bridge](https://wiki.seeedstudio.com/reTerminalBridge/). Currently the **accelerometer, user LEDs, user buttons and buzzer** can be accessed using this Python library on reTerminal, and the **fan, RS232, RS485, CAN** can be accessed by using this Python library on reTerminal Bridge.
3+
This is a Python library specifically designed for Seeed's RPi boards, enabling you to utilize the onboard hardware features. Currently, the accelerometer, user LEDs, user buttons, and buzzer can be accessed and controlled using this library on Seeed's RPi boards. Additionally, if your board supports features like a fan, RS232, RS485, or CAN, this library provides the necessary interfaces to interact with them as well.
44

55
## Installation
66

77
### From PyPI
88

99
- To install the latest release from PyPI
1010
```
11-
sudo pip3 install seeed-python-reterminal
11+
sudo pip3 install seeed-python-rpi
1212
```
1313

1414
### From Source
1515

1616
- To install from source, clone this repository
1717
```
18-
git clone https://github.com/Seeed-Studio/Seeed_Python_ReTerminal
18+
git clone https://github.com/Seeed-Studio/Seeed_Python_RPi
1919
```
2020

2121
- Install the library
2222

2323
```
24-
cd Seeed_Python_ReTerminal
24+
cd Seeed_Python_rpi
2525
sudo pip3 install .
2626
```
2727

@@ -30,7 +30,7 @@ sudo pip3 install .
3030
### User LEDs Test
3131

3232
```python
33-
import seeed_python_reterminal.core as rt
33+
import seeed_python_rpi.core as rt
3434
import time
3535

3636
print("STA ON, USR OFF")
@@ -57,7 +57,7 @@ rt.usr_led = False
5757
### Buzzer Test
5858

5959
```python
60-
import seeed_python_reterminal.core as rt
60+
import seeed_python_rpi.core as rt
6161
import time
6262

6363
print("BUZZER ON")
@@ -71,8 +71,8 @@ rt.buzzer = False
7171
### User Buttons Test
7272

7373
```python
74-
import seeed_python_reterminal.core as rt
75-
import seeed_python_reterminal.button as rt_btn
74+
import seeed_python_rpi.core as rt
75+
import seeed_python_rpi.button as rt_btn
7676

7777

7878
device = rt.get_button_device()
@@ -86,8 +86,8 @@ while True:
8686
### Accelerometer Test
8787

8888
```python
89-
import seeed_python_reterminal.core as rt
90-
import seeed_python_reterminal.acceleration as rt_accel
89+
import seeed_python_rpi.core as rt
90+
import seeed_python_rpi.acceleration as rt_accel
9191

9292

9393
device = rt.get_acceleration_device()
@@ -102,9 +102,9 @@ while True:
102102

103103
```python
104104
import asyncio
105-
import seeed_python_reterminal.core as rt
106-
import seeed_python_reterminal.acceleration as rt_accel
107-
import seeed_python_reterminal.button as rt_btn
105+
import seeed_python_rpi.core as rt
106+
import seeed_python_rpi.acceleration as rt_accel
107+
import seeed_python_rpi.button as rt_btn
108108

109109

110110
async def accel_coroutine(device):
@@ -134,7 +134,7 @@ loop.run_forever()
134134
### Illuminance Sensor Test
135135
```python
136136
import time
137-
import seeed_python_reterminal.core as rt
137+
import seeed_python_rpi.core as rt
138138

139139
while True:
140140
print(rt.illuminance)
@@ -146,7 +146,7 @@ while True:
146146
### fan Test
147147

148148
```python
149-
import seeed_python_reterminal.core as rt
149+
import seeed_python_rpi.core as rt
150150
import time
151151

152152
print("FAN ON")
@@ -163,7 +163,7 @@ rt.fan = False
163163
import sys
164164
import serial
165165
import time
166-
import seeed_python_reterminal.core as rt
166+
import seeed_python_rpi.core as rt
167167

168168
param1 = sys.argv[1]
169169

@@ -217,7 +217,7 @@ python3 test_rs232.py receive # test the receive(RX) function of RS232
217217
import sys
218218
import serial
219219
import time
220-
import seeed_python_reterminal.core as rt
220+
import seeed_python_rpi.core as rt
221221

222222
param1 = sys.argv[1]
223223

samples/test_accel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22

3-
import seeed_python_reterminal.core as rt
4-
import seeed_python_reterminal.acceleration as rt_accel
3+
import seeed_python_rpi.core as rt
4+
import seeed_python_rpi.acceleration as rt_accel
55

66

77
device = rt.get_acceleration_device()

samples/test_accel_and_button.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env python3
22

33
import asyncio
4-
import seeed_python_reterminal.core as rt
5-
import seeed_python_reterminal.acceleration as rt_accel
6-
import seeed_python_reterminal.button as rt_btn
4+
import seeed_python_rpi.core as rt
5+
import seeed_python_rpi.acceleration as rt_accel
6+
import seeed_python_rpi.button as rt_btn
77

88

99
async def accel_coroutine(device):

samples/test_button.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22

3-
import seeed_python_reterminal.core as rt
4-
import seeed_python_reterminal.button as rt_btn
3+
import seeed_python_rpi.core as rt
4+
import seeed_python_rpi.button as rt_btn
55

66

77
device = rt.get_button_device()

samples/test_buzzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
import seeed_python_reterminal.core as rt
3+
import seeed_python_rpi.core as rt
44
import time
55

66
print("BUZZER ON")

samples/test_fan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
import seeed_python_reterminal.core as rt
3+
import seeed_python_rpi.core as rt
44
import time
55

66
print("FAN ON")

samples/test_led.py

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,49 @@
11
#!/usr/bin/env python3
22

3-
import seeed_python_reterminal.core as rt
3+
import seeed_python_rpi.core as rt
44
import time
55

6-
print("STA ON, USR OFF")
7-
rt.sta_led = True
8-
rt.usr_led = False
9-
time.sleep(1)
6+
try:
7+
get_led = rt.sta_led
8+
print("STA BLINK ")
9+
rt.sta_led = True
10+
time.sleep(1)
11+
rt.sta_led = False
12+
except:
13+
pass
1014

11-
print("STA OFF, USR ON")
12-
rt.sta_led = False
13-
rt.usr_led = True
14-
time.sleep(1)
15-
16-
print("STA RED, USR OFF")
17-
rt.sta_led_green = False
18-
rt.sta_led_red = True
19-
rt.usr_led = False
20-
time.sleep(1)
21-
22-
print("STA OFF, USR OFF")
23-
rt.sta_led = False
24-
rt.usr_led = False
15+
try:
16+
get_led = rt.usr_led
17+
print("USR BLINK ")
18+
rt.usr_led = True
19+
time.sleep(1)
20+
rt.usr_led = False
21+
except:
22+
pass
23+
24+
try:
25+
get_led = rt.sta_led_green
26+
print("STA GREEN BLINK ")
27+
rt.sta_led_green = True
28+
time.sleep(1)
29+
rt.sta_led_green = False
30+
except:
31+
pass
32+
33+
try:
34+
get_led = rt.sta_led_red
35+
print("STA RED BLINK ")
36+
rt.sta_led_red = True
37+
time.sleep(1)
38+
rt.sta_led_red = False
39+
except:
40+
pass
41+
42+
try:
43+
get_led = rt.sta_led_blue
44+
print("STA BLUE BLINK ")
45+
rt.sta_led_blue = True
46+
time.sleep(1)
47+
rt.sta_led_blue = False
48+
except:
49+
pass

samples/test_light.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22

33
import time
4-
import seeed_python_reterminal.core as rt
4+
import seeed_python_rpi.core as rt
55

66
while True:
77
print(rt.illuminance)

samples/test_rs232.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
import serial
55
import time
6-
import seeed_python_reterminal.core as rt
6+
import seeed_python_rpi.core as rt
77

88
param1 = sys.argv[1]
99

samples/test_rs485.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
import serial
55
import time
6-
import seeed_python_reterminal.core as rt
6+
import seeed_python_rpi.core as rt
77

88
param1 = sys.argv[1]
99

0 commit comments

Comments
 (0)