remove unused files. Kind of moved to a new repor for now for all micro-python scripts and testing. and have regular python scripts and testing in another repo

This commit is contained in:
Aaron 2025-11-04 22:13:33 -05:00
parent 79f5e866c8
commit c0e8fb97e2
15 changed files with 0 additions and 307 deletions

View File

@ -1,34 +0,0 @@
import machine
import utime
sensor_temp = machine.ADC(machine.ADC.CORE_TEMP)
conversion_factor = 3.3 / (65535)
led_onboard = machine.Pin(25, machine.Pin.OUT)
led_onboard.value(0)
rtc=machine.RTC()
file = open("temps.txt", "w")
#file = open("temps.txt", "a") # To append to log file rather than overwrite
while True:
reading = sensor_temp.read_u16() * conversion_factor
timestamp=rtc.datetime()
temperature = 27 - (reading - 0.706)/0.001721
timestring="%04d-%02d-%02d %02d:%02d:%02d"%(timestamp[0:3] +
timestamp[4:7])
file.write(timestring + "," + str(temperature) + "\n")
file.flush()
led_onboard.value(1)
utime.sleep(0.01)
led_onboard.value(0)
utime.sleep(30)
# Notes
# Given that space is at a premium when writing logs to files on the
# internal Flash, one option may be produce timestamps and then deltas or
# changes after that, forcing a full timestamp every so often to ensure
# things are synchronised

View File

@ -1,7 +0,0 @@
# Auto Garden Scripts
### Script I'd like to take note of
Scirpts:
- [Lights on and Off at Intervals](Lights-on-off-intervals.py)
- [Log Date and Time](Log-Date-and-Time.py)
- [Onboard LED On](Onboard-LED-On.py)

View File

@ -1,8 +0,0 @@
from machine import Pin, Timer
led = machine.Pin("LED", machine.Pin.OUT)
timer = Timer()
def blink(timer):
led.toggle()
timer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)

View File

@ -1,11 +0,0 @@
from machine import Pin, Timer
ledMachine = machine.Pin("LED", machine.Pin.OUT)
led = Pin(12, Pin.OUT)
timer = Timer()
def blink(timer):
led.toggle()
ledMachine.toggle()
timer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)

View File

@ -1,14 +0,0 @@
from machine import Pin, PWM
from time import sleep
pwm = PWM(Pin(12))
pwm.freq(5000)
while True:
for duty in range(65025):
pwm.duty_u16(duty)
sleep(0.0005)
for duty in range(65025, 0, -1):
pwm.duty_u16(duty)
sleep(0.0005)

View File

@ -1,22 +0,0 @@
from machine import Pin,PWM
from pwm import myPWM
import time
mypwm = myPWM(16, 17, 18, 19, 20, 21, 22, 26, 27, 28)
chns = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
dutys = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65535, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
delayTimes = 50
try:
while True:
for i in range(0, 20):
for j in range(0, 10):
mypwm.ledcWrite(chns[j], dutys[i+j])
time.sleep_ms(delayTimes)
for i in range(0, 20):
for j in range(0, 10):
mypwm.ledcWrite(chns[9 -j], dutys[i+j])
time.sleep_ms(delayTimes)
except:
mypwm.deinit()

View File

@ -1,8 +0,0 @@
from machine import Pin, Timer
led = Pin(15, Pin.OUT)
timer = Timer()
def blink(timer):
led.toggle()
timer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)

View File

@ -1,4 +0,0 @@
import machine
led = machine.Pin("LED", machine.Pin.OUT)
led.off()
led.on()

View File

@ -1,9 +0,0 @@
import machine
led = machine.Pin("LED", machine.Pin.OUT)
led.off() # Make sure off
led.on() # Turn on last command, stays on
contactorV12 = Pin(12, Pin.OUT)
contactorV12.off()
contactorV12.on()

View File

@ -1,12 +0,0 @@
from machine import Pin, Timer
# First Testing Env
ledMachine = machine.Pin("LED", machine.Pin.OUT)
# led = Pin(12, Pin.OUT)
timer = Timer()
def blink(timer):
# led.toggle()
ledMachine.toggle()
timer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)

View File

@ -1,75 +0,0 @@
import network
import time
def scan_networks(timeout=10):
"""
Scan for available WiFi networks and return formatted results.
Returns list of dicts with network info.
"""
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
print("Scanning for networks...")
networks = wlan.scan()
# Format results
results = []
for net in networks:
ssid, bssid, channel, rssi, security, hidden = net
# Decode SSID if bytes
if isinstance(ssid, bytes):
ssid = ssid.decode('utf-8')
# Security type mapping
security_types = {
0: "Open",
1: "WEP",
2: "WPA-PSK",
3: "WPA2-PSK",
4: "WPA/WPA2-PSK"
}
results.append({
"ssid": ssid,
"bssid": ":".join(["%02X" % b for b in bssid]),
"channel": channel,
"rssi": rssi,
"security": security_types.get(security, "Unknown"),
"hidden": bool(hidden)
})
# Sort by signal strength (strongest first)
results.sort(key=lambda x: x["rssi"], reverse=True)
return results
def print_networks(networks):
"""Pretty print network scan results."""
print("\n" + "="*70)
print(f"Found {len(networks)} networks:")
print("="*70)
for i, net in enumerate(networks, 1):
print(f"\n{i}. {net['ssid']}")
print(f" BSSID: {net['bssid']}")
print(f" Channel: {net['channel']}")
print(f" Signal: {net['rssi']} dBm")
print(f" Security: {net['security']}")
if net['hidden']:
print(f" (Hidden Network)")
print("\n" + "="*70)
def find_network(ssid):
"""Find a specific network by SSID."""
networks = scan_networks()
for net in networks:
if net['ssid'] == ssid:
return net
return None
# Run scan if executed directly
if __name__ == "__main__":
networks = scan_networks()
print_networks(networks)

View File

@ -1,4 +0,0 @@
import machine
led = machine.Pin("LED", machine.Pin.OUT)
led.off()
led.on()

View File

@ -1,63 +0,0 @@
from machine import Pin,PWM
class myPWM():
def __init__(self, pwm0: int=16, pwm1: int=17, pwm2: int=18, pwm3: int=19, pwm4: int=20, pwm5: int=21, pwm6: int=22, pwm7: int=26, pwm8: int=27, pwm9: int=28, freq_num: int=10000):
self._pwm0 = PWM(Pin(pwm0))
self._pwm0.freq(freq_num)
self._pwm1 = PWM(Pin(pwm1))
self._pwm1.freq(freq_num)
self._pwm2 = PWM(Pin(pwm2))
self._pwm2.freq(freq_num)
self._pwm3 = PWM(Pin(pwm3))
self._pwm3.freq(freq_num)
self._pwm4 = PWM(Pin(pwm4))
self._pwm4.freq(freq_num)
self._pwm5 = PWM(Pin(pwm5))
self._pwm5.freq(freq_num)
self._pwm6 = PWM(Pin(pwm6))
self._pwm6.freq(freq_num)
self._pwm7 = PWM(Pin(pwm7))
self._pwm7.freq(freq_num)
self._pwm8 = PWM(Pin(pwm8))
self._pwm8.freq(freq_num)
self._pwm9 = PWM(Pin(pwm9))
self._pwm9.freq(freq_num)
def ledcWrite(self,chn,value):
if chn == 0:
self._pwm0.duty_u16(value)
elif chn == 1:
self._pwm1.duty_u16(value)
elif chn == 2:
self._pwm2.duty_u16(value)
elif chn == 3:
self._pwm3.duty_u16(value)
elif chn == 4:
self._pwm4.duty_u16(value)
elif chn == 5:
self._pwm5.duty_u16(value)
elif chn == 6:
self._pwm6.duty_u16(value)
elif chn == 7:
self._pwm7.duty_u16(value)
elif chn == 8:
self._pwm8.duty_u16(value)
elif chn == 9:
self._pwm9.duty_u16(value)
def deinit(self):
self._pwm0.deinit()
self._pwm1.deinit()
self._pwm2.deinit()
self._pwm3.deinit()
self._pwm4.deinit()
self._pwm5.deinit()
self._pwm6.deinit()
self._pwm7.deinit()
self._pwm8.deinit()
self._pwm9.deinit()

View File

@ -1,3 +0,0 @@
from random import randint as rand
num = rand(1, 100)
print(num)

View File

@ -1,33 +0,0 @@
from machine import Pin, PWM
from random import randint
import time
pins = [15, 14, 13]
freq_num = 10000
pwm0 = PWM(Pin(pins[0])) #set PWM
pwm1 = PWM(Pin(pins[1]))
pwm2 = PWM(Pin(pins[2]))
pwm0.freq(freq_num)
pwm1.freq(freq_num)
pwm2.freq(freq_num)
def setColor(r, g, b):
pwm0.duty_u16(65535 - r)
pwm1.duty_u16(65535 - g)
pwm2.duty_u16(65535 - b)
try:
while True:
red = randint(0, 65535)
green = randint(0, 65535)
blue = randint(0, 65535)
setColor(red, green, blue)
print(red,"Red")
print(green,"Green")
print(blue,"Blue")
time.sleep_ms(200)
except:
pwm0.deinit()
pwm1.deinit()
pwm2.deinit()