Skip to content

Commit bd22963

Browse files
committed
improving_if_stataments
1 parent 0a9e9dd commit bd22963

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

examples/progressbar_accelerometer.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
main_group.append(background)
149149

150150
# Accelerometer Properties. Normally accelerometer well calibrated
151-
# Will give a maxium output of 10 mts / s**2
151+
# Will give a maximum output of 10 mts / s**2
152152
VALUES_X = (-10, 10)
153153
VALUES_Y = (-10, 10)
154154

@@ -207,25 +207,19 @@
207207

208208
while True:
209209
for val in fake__accel_data:
210-
if val[0] > 0:
210+
if val[0] >= 0:
211211
left_horizontal_bar.value = 0
212212
right_horizontal_bar.value = val[0]
213213
if val[0] < 0:
214214
left_horizontal_bar.value = -val[0]
215215
right_horizontal_bar.value = 0
216-
if val[0] == 0:
217-
right_horizontal_bar.value = 0
218-
left_horizontal_bar.value = 0
219216

220-
if val[1] > 0:
217+
if val[1] >= 0:
221218
top_vertical_bar.value = val[1]
222219
bottom_vertical_bar.value = 0
223220
if val[1] < 0:
224221
bottom_vertical_bar.value = -val[1]
225222
top_vertical_bar.value = 0
226-
if val[1] == 0:
227-
top_vertical_bar.value = 0
228-
bottom_vertical_bar.value = 0
229223

230224
display.refresh()
231225
time.sleep(delay)

0 commit comments

Comments
 (0)