Adding Pylint guide code.
This commit is contained in:
parent
5fc78a97eb
commit
ddacdca4ea
2 changed files with 45 additions and 0 deletions
0
Pylint_and_CircuitPython/.circuitpython.skip
Normal file
0
Pylint_and_CircuitPython/.circuitpython.skip
Normal file
45
Pylint_and_CircuitPython/pylint_example.py
Normal file
45
Pylint_and_CircuitPython/pylint_example.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import board
|
||||
import digitalio
|
||||
import adafruit_lis3dh
|
||||
import touchio
|
||||
import time
|
||||
import neopixel
|
||||
import adafruit_thermistor
|
||||
|
||||
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.2)
|
||||
|
||||
i2c = board.I2C()
|
||||
int1 = digitalio.DigitalInOut(board.ACCELEROMETER_UNTERRUPT)
|
||||
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1)
|
||||
|
||||
circuit_playground_temperature = adafruit_thermistor.Thermistor(board.TEMPERATURE, 10000, 10000, 25, 3950)
|
||||
|
||||
touch_A1 = touchio.TouchIn(board.A1)
|
||||
touch_A2 = touchio.TouchIn(board.A2)
|
||||
|
||||
led = digitalio.DigitalInOut(board.D13)
|
||||
led.direction = digitalio.Direction.OUTPUT
|
||||
|
||||
button_A = digitalio.DigitalInOut(board.BUTTON_A)
|
||||
button_A.direction = digitalio.Direction.INPUT
|
||||
button_A.pull = digitalio.Pull.DOWN
|
||||
|
||||
while True:
|
||||
x, y, z = lis3dh.acceleration
|
||||
|
||||
if button_A.value:
|
||||
led.value = True
|
||||
else:
|
||||
led.value = False
|
||||
|
||||
print("Temperature:", circuit_playground_temperature.temperature)
|
||||
print("Acceleration:", x, y, z)
|
||||
|
||||
if touch_A1.value:
|
||||
pixels.fill((255, 0, 0))
|
||||
if touch_A2.value:
|
||||
pixels.fill((0, 0, 255))
|
||||
else:
|
||||
pixels.fill((0, 0, 0))
|
||||
|
||||
time.sleep(0.01)
|
||||
Loading…
Reference in a new issue