read sensor
This commit is contained in:
commit
e4411e85af
9
boot.py
Normal file
9
boot.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Complete project details at https://RandomNerdTutorials.com
|
||||||
|
import esp
|
||||||
|
esp.osdebug(None)
|
||||||
|
|
||||||
|
import gc
|
||||||
|
gc.collect()
|
||||||
|
|
||||||
|
#import connectwifi
|
||||||
|
#import webserver
|
20
leds.py
Normal file
20
leds.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
"""
|
||||||
|
Functions to easy control LED
|
||||||
|
"""
|
||||||
|
|
||||||
|
# general imports
|
||||||
|
from machine import Pin, PWM
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
|
def SmoothBlink():
|
||||||
|
frequency = 5000
|
||||||
|
led = PWM(Pin(2), frequency)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
for duty_cycle in range(0, 1024):
|
||||||
|
led.duty(duty_cycle)
|
||||||
|
sleep(0.005)
|
||||||
|
for duty_cycle in reversed(range(0, 1024)):
|
||||||
|
led.duty(duty_cycle)
|
||||||
|
sleep(0.005)
|
15
main.py
Normal file
15
main.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#std lib
|
||||||
|
#import time
|
||||||
|
|
||||||
|
#custom libs
|
||||||
|
# import leds
|
||||||
|
# leds.SmoothBlink()
|
||||||
|
|
||||||
|
# read analog pin
|
||||||
|
from time import sleep
|
||||||
|
from machine import Pin, PWM, ADC
|
||||||
|
analog = ADC(0)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
print(analog.read())
|
||||||
|
sleep(1)
|
10
pymakr.conf
Normal file
10
pymakr.conf
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"py_ignore": [
|
||||||
|
".vscode",
|
||||||
|
".gitignore",
|
||||||
|
".git",
|
||||||
|
"env",
|
||||||
|
"venv"
|
||||||
|
],
|
||||||
|
"name": "FeuchtigkeitsSensor"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user