Skip to content

Commit 1dc8d73

Browse files
Merge pull request #76 from raspberrypi/trim_whitespace
Trim trailing whitespace from example Micropython code
2 parents 712964b + 609ab9c commit 1dc8d73

9 files changed

+19
-21
lines changed

adc/temperature.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
while True:
88
reading = sensor_temp.read_u16() * conversion_factor
9-
9+
1010
# The temperature sensor measures the Vbe voltage of a biased bipolar diode, connected to the fifth ADC channel
11-
# Typically, Vbe = 0.706V at 27 degrees C, with a slope of -1.721mV (0.001721) per degree.
11+
# Typically, Vbe = 0.706V at 27 degrees C, with a slope of -1.721mV (0.001721) per degree.
1212
temperature = 27 - (reading - 0.706)/0.001721
1313
print(temperature)
1414
utime.sleep(2)

bluetooth/picow_ble_temp_reader.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def value(self):
221221
def sleep_ms_flash_led(self, flash_count, delay_ms):
222222
self._led.off()
223223
while(delay_ms > 0):
224-
for i in range(flash_count):
224+
for i in range(flash_count):
225225
self._led.on()
226226
time.sleep_ms(100)
227227
self._led.off()
@@ -267,4 +267,4 @@ def on_scan(addr_type, addr, name):
267267
central = BLETemperatureCentral(ble)
268268
while(True):
269269
demo(ble, central)
270-
sleep_ms_flash_led(central, 1, 10000)
270+
sleep_ms_flash_led(central, 1, 10000)

bluetooth/picow_ble_temp_sensor.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ def _advertise(self, interval_us=500000):
8686
def _get_temp(self):
8787
conversion_factor = 3.3 / (65535)
8888
reading = self._sensor_temp.read_u16() * conversion_factor
89-
89+
9090
# The temperature sensor measures the Vbe voltage of a biased bipolar diode, connected to the fifth ADC channel
91-
# Typically, Vbe = 0.706V at 27 degrees C, with a slope of -1.721mV (0.001721) per degree.
91+
# Typically, Vbe = 0.706V at 27 degrees C, with a slope of -1.721mV (0.001721) per degree.
9292
return 27 - (reading - 0.706) / 0.001721
93-
93+
9494
def demo():
9595
ble = bluetooth.BLE()
9696
temp = BLETemperature(ble)
@@ -104,4 +104,4 @@ def demo():
104104
counter += 1
105105

106106
if __name__ == "__main__":
107-
demo()
107+
demo()

i2c/1106oled/i2c_1106oled_using_defaults.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
# Display Image & text on I2C driven SH1106 OLED display
1+
# Display Image & text on I2C driven SH1106 OLED display
22
from machine import I2C, ADC
33
from sh1106 import SH1106_I2C
44
import framebuf
55

6-
76
WIDTH = 128 # oled display width
87
HEIGHT = 128 # oled display height
98

@@ -31,4 +30,4 @@
3130
oled.text("Pico",5,15)
3231

3332
# Finally update the oled display so the image & text is displayed
34-
oled.show()
33+
oled.show()

i2c/1106oled/i2c_1106oled_with_freq.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Display Image & text on I2C driven ssd1306 OLED display
1+
# Display Image & text on I2C driven ssd1306 OLED display
22
from machine import Pin, I2C
33
from sh1106 import SH1106_I2C
44
import framebuf

i2c/1306oled/i2c_1306oled_using_defaults.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Display Image & text on I2C driven ssd1306 OLED display
1+
# Display Image & text on I2C driven ssd1306 OLED display
22
from machine import Pin, I2C
33
from ssd1306 import SSD1306_I2C
44
import framebuf

i2c/1306oled/i2c_1306oled_with_freq.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Display Image & text on I2C driven ssd1306 OLED display
1+
# Display Image & text on I2C driven ssd1306 OLED display
22
from machine import Pin, I2C
33
from ssd1306 import SSD1306_I2C
44
import framebuf

i2c/i2c.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from machine import Pin, I2C
22

3-
i2c = I2C(0, scl=Pin(9), sda=Pin(8), freq=100000)
3+
i2c = I2C(0, scl=Pin(9), sda=Pin(8), freq=100000)
44
i2c.scan()
55
i2c.writeto(76, b'123')
66
i2c.readfrom(76, 4)

pio/neopixel_ring/neopixel_ring.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def color_chase(color, wait):
5757
time.sleep(wait)
5858
pixels_show()
5959
time.sleep(0.2)
60-
60+
6161
def wheel(pos):
6262
# Input a value 0 to 255 to get a color value.
6363
# The colours are a transition r - g - b - back to r.
@@ -70,8 +70,7 @@ def wheel(pos):
7070
return (0, 255 - pos * 3, pos * 3)
7171
pos -= 170
7272
return (pos * 3, 0, 255 - pos * 3)
73-
74-
73+
7574
def rainbow_cycle(wait):
7675
for j in range(255):
7776
for i in range(NUM_LEDS):
@@ -91,14 +90,14 @@ def rainbow_cycle(wait):
9190
COLORS = (BLACK, RED, YELLOW, GREEN, CYAN, BLUE, PURPLE, WHITE)
9291

9392
print("fills")
94-
for color in COLORS:
93+
for color in COLORS:
9594
pixels_fill(color)
9695
pixels_show()
9796
time.sleep(0.2)
9897

9998
print("chases")
100-
for color in COLORS:
99+
for color in COLORS:
101100
color_chase(color, 0.01)
102101

103102
print("rainbow")
104-
rainbow_cycle(0)
103+
rainbow_cycle(0)

0 commit comments

Comments
 (0)