initial commit
This commit is contained in:
commit
e50722f69b
3
lightshow/.micropico
Normal file
3
lightshow/.micropico
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"info": "This file is just used to identify a project folder."
|
||||||
|
}
|
13
lightshow/blink.py
Normal file
13
lightshow/blink.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import machine, neopixel, time
|
||||||
|
|
||||||
|
# defines `np`, pin the led is on = 16, number of leds = 1
|
||||||
|
np = neopixel.NeoPixel(machine.Pin(16), 1)
|
||||||
|
|
||||||
|
diddlydoobalobby = 1
|
||||||
|
while diddlydoobalobby > 0:
|
||||||
|
np[0] = (20, 20, 20)
|
||||||
|
np.write()
|
||||||
|
time.sleep(1)
|
||||||
|
np[0] = (0, 0, 0)
|
||||||
|
np.write()
|
||||||
|
time.sleep(0.750)
|
25
lightshow/blink_rgb.py
Normal file
25
lightshow/blink_rgb.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import machine, neopixel, time
|
||||||
|
|
||||||
|
# defines `np`, pin the led is on = 16, number of leds = 1
|
||||||
|
np = neopixel.NeoPixel(machine.Pin(16), 1)
|
||||||
|
|
||||||
|
diddlydoobalobby = 1
|
||||||
|
while diddlydoobalobby > 0:
|
||||||
|
np[0] = (75, 0, 0)
|
||||||
|
np.write()
|
||||||
|
time.sleep(0.75)
|
||||||
|
np[0] = (0, 0, 0)
|
||||||
|
np.write()
|
||||||
|
time.sleep(0.75)
|
||||||
|
np[0] = (0, 75, 0)
|
||||||
|
np.write()
|
||||||
|
time.sleep(0.75)
|
||||||
|
np[0] = (0, 0, 0)
|
||||||
|
np.write()
|
||||||
|
time.sleep(0.75)
|
||||||
|
np[0] = (0, 0, 75)
|
||||||
|
np.write()
|
||||||
|
time.sleep(0.75)
|
||||||
|
np[0] = (0, 0, 0)
|
||||||
|
np.write()
|
||||||
|
time.sleep(0.75)
|
19
lightshow/smoothwhite.py
Normal file
19
lightshow/smoothwhite.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import machine, neopixel, time
|
||||||
|
|
||||||
|
# defines `np`, pin the led is on = 16, number of leds = 1
|
||||||
|
np = neopixel.NeoPixel(machine.Pin(16), 1)
|
||||||
|
|
||||||
|
diddlydoobalobby = 1
|
||||||
|
while diddlydoobalobby > 0:
|
||||||
|
for blueval in range(200):
|
||||||
|
np[0] = (0, 0, blueval)
|
||||||
|
np.write()
|
||||||
|
time.sleep(0.02)
|
||||||
|
for redval in range(200):
|
||||||
|
np[0] = (redval, 0, 200)
|
||||||
|
np.write()
|
||||||
|
time.sleep(0.02)
|
||||||
|
for greenval in range(200):
|
||||||
|
np[0] = (200, greenval, 200)
|
||||||
|
np.write()
|
||||||
|
time.sleep(0.02)
|
1
lightshow/temperature.py
Normal file
1
lightshow/temperature.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
# ugh. damn aliexpress and their damn sellers not publishing their damn pinouts
|
37
lightshow/ultrasonic.py
Normal file
37
lightshow/ultrasonic.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
from machine import Pin
|
||||||
|
import utime
|
||||||
|
import neopixel
|
||||||
|
|
||||||
|
np = neopixel.NeoPixel(machine.Pin(16), 1)
|
||||||
|
|
||||||
|
trigger = Pin(12, Pin.OUT)
|
||||||
|
echo = Pin(11, Pin.IN)
|
||||||
|
|
||||||
|
def ultradistance():
|
||||||
|
|
||||||
|
np[0] = (0, 0, 20)
|
||||||
|
np.write()
|
||||||
|
|
||||||
|
trigger.low()
|
||||||
|
utime.sleep_us(2)
|
||||||
|
|
||||||
|
trigger.high()
|
||||||
|
utime.sleep_us(5)
|
||||||
|
trigger.low()
|
||||||
|
|
||||||
|
while echo.value() == 0:
|
||||||
|
signaloff = utime.ticks_us()
|
||||||
|
while echo.value() == 1:
|
||||||
|
signalon = utime.ticks_us()
|
||||||
|
|
||||||
|
timepassed = signalon - signaloff
|
||||||
|
|
||||||
|
distance = round(((timepassed * 0.0343) / 2), 1)
|
||||||
|
print(distance)
|
||||||
|
|
||||||
|
np[0] = (0, 0, 0)
|
||||||
|
np.write()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
ultradistance()
|
||||||
|
utime.sleep(0.25)
|
Loading…
x
Reference in New Issue
Block a user