From c0e8fb97e29ded231c6f35ccee8038d40d44e52c Mon Sep 17 00:00:00 2001 From: sickprodigy Date: Tue, 4 Nov 2025 22:13:33 -0500 Subject: [PATCH] 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 --- Scripts/Log-Date-and-Time.py | 34 -------------- Scripts/README.md | 7 --- Scripts/blink-onboard-led.py | 8 ---- Scripts/flash_on_board_and_led.py | 11 ----- Scripts/flashing_led.py | 14 ------ Scripts/flowing_lights.py | 22 --------- Scripts/led_blink.py | 8 ---- Scripts/light_on.py | 4 -- Scripts/lights_on_off_intervals.py | 9 ---- Scripts/main.py | 12 ----- Scripts/network_scan.py | 75 ------------------------------ Scripts/onboard_led_on.py | 4 -- Scripts/pwm.py | 63 ------------------------- Scripts/random_number.py | 3 -- Scripts/rgb_led_random_color.py | 33 ------------- 15 files changed, 307 deletions(-) delete mode 100644 Scripts/Log-Date-and-Time.py delete mode 100644 Scripts/README.md delete mode 100644 Scripts/blink-onboard-led.py delete mode 100644 Scripts/flash_on_board_and_led.py delete mode 100644 Scripts/flashing_led.py delete mode 100644 Scripts/flowing_lights.py delete mode 100644 Scripts/led_blink.py delete mode 100644 Scripts/light_on.py delete mode 100644 Scripts/lights_on_off_intervals.py delete mode 100644 Scripts/main.py delete mode 100644 Scripts/network_scan.py delete mode 100644 Scripts/onboard_led_on.py delete mode 100644 Scripts/pwm.py delete mode 100644 Scripts/random_number.py delete mode 100644 Scripts/rgb_led_random_color.py diff --git a/Scripts/Log-Date-and-Time.py b/Scripts/Log-Date-and-Time.py deleted file mode 100644 index 3285fa5..0000000 --- a/Scripts/Log-Date-and-Time.py +++ /dev/null @@ -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 diff --git a/Scripts/README.md b/Scripts/README.md deleted file mode 100644 index d360568..0000000 --- a/Scripts/README.md +++ /dev/null @@ -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) diff --git a/Scripts/blink-onboard-led.py b/Scripts/blink-onboard-led.py deleted file mode 100644 index 38c7251..0000000 --- a/Scripts/blink-onboard-led.py +++ /dev/null @@ -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) \ No newline at end of file diff --git a/Scripts/flash_on_board_and_led.py b/Scripts/flash_on_board_and_led.py deleted file mode 100644 index 6ce1933..0000000 --- a/Scripts/flash_on_board_and_led.py +++ /dev/null @@ -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) \ No newline at end of file diff --git a/Scripts/flashing_led.py b/Scripts/flashing_led.py deleted file mode 100644 index ddcbf50..0000000 --- a/Scripts/flashing_led.py +++ /dev/null @@ -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) \ No newline at end of file diff --git a/Scripts/flowing_lights.py b/Scripts/flowing_lights.py deleted file mode 100644 index 35e0a3c..0000000 --- a/Scripts/flowing_lights.py +++ /dev/null @@ -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() diff --git a/Scripts/led_blink.py b/Scripts/led_blink.py deleted file mode 100644 index 6543f13..0000000 --- a/Scripts/led_blink.py +++ /dev/null @@ -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) \ No newline at end of file diff --git a/Scripts/light_on.py b/Scripts/light_on.py deleted file mode 100644 index d0d97f9..0000000 --- a/Scripts/light_on.py +++ /dev/null @@ -1,4 +0,0 @@ -import machine -led = machine.Pin("LED", machine.Pin.OUT) -led.off() -led.on() \ No newline at end of file diff --git a/Scripts/lights_on_off_intervals.py b/Scripts/lights_on_off_intervals.py deleted file mode 100644 index 412649d..0000000 --- a/Scripts/lights_on_off_intervals.py +++ /dev/null @@ -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() \ No newline at end of file diff --git a/Scripts/main.py b/Scripts/main.py deleted file mode 100644 index 96b6232..0000000 --- a/Scripts/main.py +++ /dev/null @@ -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) diff --git a/Scripts/network_scan.py b/Scripts/network_scan.py deleted file mode 100644 index 7434c05..0000000 --- a/Scripts/network_scan.py +++ /dev/null @@ -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) diff --git a/Scripts/onboard_led_on.py b/Scripts/onboard_led_on.py deleted file mode 100644 index d0d97f9..0000000 --- a/Scripts/onboard_led_on.py +++ /dev/null @@ -1,4 +0,0 @@ -import machine -led = machine.Pin("LED", machine.Pin.OUT) -led.off() -led.on() \ No newline at end of file diff --git a/Scripts/pwm.py b/Scripts/pwm.py deleted file mode 100644 index d07c7ed..0000000 --- a/Scripts/pwm.py +++ /dev/null @@ -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() - - diff --git a/Scripts/random_number.py b/Scripts/random_number.py deleted file mode 100644 index c66655a..0000000 --- a/Scripts/random_number.py +++ /dev/null @@ -1,3 +0,0 @@ -from random import randint as rand -num = rand(1, 100) -print(num) \ No newline at end of file diff --git a/Scripts/rgb_led_random_color.py b/Scripts/rgb_led_random_color.py deleted file mode 100644 index 7a9a4af..0000000 --- a/Scripts/rgb_led_random_color.py +++ /dev/null @@ -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() \ No newline at end of file