Skip to content

Commit 6c83533

Browse files
JosipKucigithub-actions[bot]
authored andcommitted
Apply Ruff formatting (MicroPython-safe)
1 parent af5c155 commit 6c83533

8 files changed

Lines changed: 38 additions & 58 deletions

File tree

BME280/BME280/Examples/bme280-allValues.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import time
99

1010
# If you aren't using the Qwiic connector, manually enter your I2C pins
11-
#i2c = I2C(0, scl=Pin(22), sda=Pin(21))
12-
#bme280 = BME280(i2c)
11+
# i2c = I2C(0, scl=Pin(22), sda=Pin(21))
12+
# bme280 = BME280(i2c)
1313

1414
# Initialize sensor over Qwiic
1515
bme280 = BME280()

BME280/BME280/bme280.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, i2c=None, address=0x76):
3030
self.i2c = I2C(0, scl=Pin(22), sda=Pin(21))
3131
else:
3232
raise Exception("Board not recognized, enter I2C pins manually")
33-
33+
3434
self.address = address
3535
self._load_calibration_params()
3636
self._configure_sensor()
@@ -206,4 +206,3 @@ def calculateAltitude(self):
206206
data = self.i2c.readfrom_mem(self.address, 0xF7, 8)
207207
raw_press = (data[0] << 12) | (data[1] << 4) | (data[2] >> 4)
208208
return 44330.0 * (1.0 - pow(self.readPressure(raw_press) / seaLevel, 0.1903))
209-

LCD-I2C/LCD-I2C/Examples/lcdI2C-example.py

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,30 @@
99
from lcdI2C import LCD_I2C
1010

1111
# If you aren't using the Qwiic connector, manually enter your I2C pins
12-
#i2c = I2C(0, scl=Pin(22), sda=Pin(21))
13-
#lcd = LCD_I2C(i2c)
12+
# i2c = I2C(0, scl=Pin(22), sda=Pin(21))
13+
# lcd = LCD_I2C(i2c)
1414

1515
# Initialize sensor over Qwiic
1616
lcd = LCD_I2C()
1717

18-
#Turn on the backlight of the LCD
18+
# Turn on the backlight of the LCD
1919
lcd.backlight()
2020

21-
#Start communication with the LCD over I2C
21+
# Start communication with the LCD over I2C
2222
lcd.begin()
2323

2424
# Hello world example
25-
#Sets the cursor to the first character place in the first row
25+
# Sets the cursor to the first character place in the first row
2626
lcd.setCursor(0, 0)
2727
lcd.print("Hello, World!")
28-
#Sets the cursor to the first character place in the second row
28+
# Sets the cursor to the first character place in the second row
2929
lcd.setCursor(0, 1)
3030
lcd.print("Made by Soldered!")
3131

3232
time.sleep(5.0)
3333

3434
# Custom character example, Characters are in binary form, each row represents a row of pixels and a 1 represents that a pixel is turned on
35-
#A smiley face :)
35+
# A smiley face :)
3636
happy = [
3737
0b00000,
3838
0b10001,
@@ -44,7 +44,7 @@
4444
0b00000,
4545
]
4646

47-
#A shocked face :o
47+
# A shocked face :o
4848
wow = [
4949
0b00000,
5050
0b10001,
@@ -56,37 +56,19 @@
5656
0b00000,
5757
]
5858

59-
#An anchor
60-
anchor = [
61-
0b01110,
62-
0b01010,
63-
0b01110,
64-
0b00100,
65-
0b10101,
66-
0b10101,
67-
0b01110,
68-
0b00100
69-
]
59+
# An anchor
60+
anchor = [0b01110, 0b01010, 0b01110, 0b00100, 0b10101, 0b10101, 0b01110, 0b00100]
7061

71-
#A snowflake
72-
snow = [
73-
0b01000,
74-
0b11101,
75-
0b01011,
76-
0b00001,
77-
0b00100,
78-
0b01110,
79-
0b00100,
80-
0b10000
81-
]
62+
# A snowflake
63+
snow = [0b01000, 0b11101, 0b01011, 0b00001, 0b00100, 0b01110, 0b00100, 0b10000]
8264

83-
#Write the defined c haracters into memory
65+
# Write the defined c haracters into memory
8466
lcd.createChar(0, happy)
8567
lcd.createChar(1, wow)
8668
lcd.createChar(2, anchor)
8769
lcd.createChar(3, snow)
8870

89-
#Clear the screen
71+
# Clear the screen
9072
lcd.clear()
9173

9274
lcd.setCursor(0, 0)
@@ -100,13 +82,13 @@
10082
# Autoscroll example
10183

10284
lcd.clear()
103-
sentence="Autoscroll example"
104-
#When autoscroll is enabled, the characters will scroll to the left to make room for oncoming characters
85+
sentence = "Autoscroll example"
86+
# When autoscroll is enabled, the characters will scroll to the left to make room for oncoming characters
10587
lcd.autoscroll()
106-
#Set cursor to the last place in row
107-
lcd.setCursor(16,0)
108-
#Go through each character in sentence and print one every second
109-
for i in range (len(sentence)):
110-
#Display the character onto the screen
88+
# Set cursor to the last place in row
89+
lcd.setCursor(16, 0)
90+
# Go through each character in sentence and print one every second
91+
for i in range(len(sentence)):
92+
# Display the character onto the screen
11193
lcd.print(sentence[i])
112-
time.sleep(1.0)
94+
time.sleep(1.0)

LCD-I2C/LCD-I2C/lcdI2C.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self, i2c: I2C, address=0x20):
5050
self.i2c = I2C(0, scl=Pin(22), sda=Pin(21))
5151
else:
5252
raise Exception("Board not recognized, enter I2C pins manually")
53-
53+
5454
self._address = address
5555
self._output = LCDOutput()
5656
self._entryState = 0b10 # Left-to-right text entry mode

PirSensor/PirSensor/Examples/PirSensor-Native-example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
while 1:
1515
# If movement is detected, the SOUT or DOUT pin will go into a HIGH state
1616
if pir.get_state():
17-
#Inform the user that motion was detected
17+
# Inform the user that motion was detected
1818
print("Motion detected!")
19-
#Pause for 1 second
19+
# Pause for 1 second
2020
time.sleep(1)

PirSensor/PirSensor/Examples/PirSensor-Qwiic-example.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
import time
88

99
# Initialize the sensor at a specific address
10-
pir = PIRSensor(address=0x30) #By default the address is 0x30
11-
pir.begin()#Initialize I2C communication with the PIR sensor
10+
pir = PIRSensor(address=0x30) # By default the address is 0x30
11+
pir.begin() # Initialize I2C communication with the PIR sensor
1212

13-
#Infinite loop
13+
# Infinite loop
1414
while 1:
1515
# Check if the pir sensor is responding via I2C
1616
if pir.available():
1717
# If movement is detected, inform user
1818
if pir.get_state():
19-
#Set how long the delay from the sensor will be before alerting of movement
19+
# Set how long the delay from the sensor will be before alerting of movement
2020
pir.set_delay(1)
2121
print("Motion detected!")
22-
#Pause for 1 second
22+
# Pause for 1 second
2323
time.sleep(1)

SHTC3/SHTC3/Examples/shtc3-example.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
import time
99

1010
# If you aren't using the Qwiic connector, manually enter your I2C pins
11-
#i2c = I2C(0, scl=Pin(22), sda=Pin(21))
12-
#shtc3 = SHTC3(i2c)
11+
# i2c = I2C(0, scl=Pin(22), sda=Pin(21))
12+
# shtc3 = SHTC3(i2c)
1313

1414
# Initialize sensor over Qwiic
1515
shtc3 = SHTC3()
1616

1717

18-
#Infinite loop
18+
# Infinite loop
1919
while 1:
2020
# The sensor must sample the values before we can read them
2121
shtc3.sample()
@@ -24,9 +24,9 @@
2424
temperature = shtc3.readTemperature()
2525
humidity = shtc3.readHumidity()
2626

27-
#Print out the read values
27+
# Print out the read values
2828
print("Temperature: {:.2f} C".format(temperature))
2929
print("Humidity: {:.2f} %\n".format(humidity))
3030

31-
#Pause for 5 seconds
31+
# Pause for 5 seconds
3232
time.sleep(5.0)

SHTC3/SHTC3/shtc3.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,3 @@ def readHumidity(self):
145145
Call sample() before to update the value.
146146
"""
147147
return self._h * H_K
148-

0 commit comments

Comments
 (0)