Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import ST7735
from PIL import Image, ImageDraw
from enviroplus.noise import Noise
print("""noise-profile.py - Get a simple noise profile.
This example grabs a basic 3-bin noise profile of low, medium and high frequency noise, plotting the noise characteristics as coloured bars.
Press Ctrl+C to exit!
""")
noise = Noise()
disp = ST7735.ST7735(
port=0,
cs=ST7735.BG_SPI_CS_FRONT,
dc=9,
backlight=12,
rotation=90)
disp.begin()
img = Image.new('RGB', (disp.width, disp.height), color=(0, 0, 0))
draw = ImageDraw.Draw(img)
while True:
low, mid, high, amp = noise.get_noise_profile()
import ST7735
from PIL import Image, ImageDraw
from enviroplus.noise import Noise
print("""noise-amps-at-freqs.py - Measure amplitude from specific frequency bins
This example retrieves the median amplitude from 3 user-specified frequency ranges and plots them in Blue, Green and Red on the Enviro+ display.
As you play a continuous rising tone on your phone, you should notice peaks that correspond to the frequency entering each range.
Press Ctrl+C to exit!
""")
noise = Noise()
disp = ST7735.ST7735(
port=0,
cs=ST7735.BG_SPI_CS_FRONT,
dc=9,
backlight=12,
rotation=90)
disp.begin()
img = Image.new('RGB', (disp.width, disp.height), color=(0, 0, 0))
draw = ImageDraw.Draw(img)
while True:
amps = noise.get_amplitudes_at_frequency_ranges([