From 51a88a40f735007649d8ef46526c9126364dceb0 Mon Sep 17 00:00:00 2001 From: sickprodigy Date: Sat, 4 May 2024 18:58:30 -0400 Subject: [PATCH] where I was before I deleted everything --- main-backup.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 main-backup.py diff --git a/main-backup.py b/main-backup.py new file mode 100644 index 0000000..c2a4d0f --- /dev/null +++ b/main-backup.py @@ -0,0 +1,47 @@ +from machine import Pin +import time +import network +import urequests as requests +from secrets import secrets + +# Load login data from different file for security! +# ssid = secrets['ssid'] +# pw = secrets['pw'] + +# Initialize pins +contactorLights = Pin(18, Pin.OUT) +led = machine.Pin("LED", machine.Pin.OUT) + + +led.low() +contactorLights.low() # sets to lowest setting 0 first. + +contactorLights.toggle() # Toggle contactor on for testing + +# Network connection going through +wifi = network.WLAN(network.STA_IF) +wifi.active(True) # must capitalize boolean statements! +wifi.connect(secrets['ssid'], secrets['password']) + +print(wifi.ifconfig()) # no ip being applied + +#Proof connected +led.on() +print('Connected to Wi-Fi network') # saying connected but not +time.sleep(5) +led.off() + +# If disconnect will flash light +while wifi.isconnected() == False: + led.on() + time.sleep(0.5) + led.off() + time.sleep(0.5) + +# think the while loop will hold the next line from running, we will see + +# while True: +# led.toggle() +# utime.sleep(0.2) + +# Need to log time accurately. Connect to internet with wifi and set time. Start logging. Also need temp probes and how to pull temps \ No newline at end of file