From c8dcddd2b574fc3f49fa38a8494f93907ca67901 Mon Sep 17 00:00:00 2001 From: Eric Yu Date: Mon, 15 Aug 2022 13:54:42 -0700 Subject: [PATCH 1/4] Update espVoltmeter.ino --- espVoltmeter/espVoltmeter.ino | 51 ++++++++++------------------------- 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/espVoltmeter/espVoltmeter.ino b/espVoltmeter/espVoltmeter.ino index 7b362b1..62bfc6e 100644 --- a/espVoltmeter/espVoltmeter.ino +++ b/espVoltmeter/espVoltmeter.ino @@ -1,57 +1,34 @@ // manually define all the An ports on ESP32 board -#if defined(ESP32) -#define A0 (36) -#define A1 (39) -#define A2 (34) -#define A3 (35) -#define A4 (32) -#define A5 (33) -#endif +#define A0 (36) +#define A1 (39) +#define A2 (34) +#define A3 (35) +#define A4 (32) +#define A5 (33) -// define the divident of sizeof()'s return value -#if defined(ESP32) +// define the divident of sizeof()'s return value, to the correct length of our list #define SIZE_DIV 4 // for esp32, the resolution is doubled than the usual arduino board, so we double the factor, too -#else -#define SIZE_DIV 2 -#endif -#define WAIT_TIME 1000UL -#define SENSOR1 36 -// FILE *f = fopen("file.txt", "w"); -int pins[] = {A0, A1, A2, A3, A4, A5}; +#define WAIT_TIME 1000UL +int pins[] = { A0, A1, A2, A3, A4, A5 }; int i, j; unsigned long currTime; // non-blocking time tracker void setup() { Serial.begin(19200); currTime = millis(); - analogReadResolution(12); - // adcAttachPin(A0); - // analogSetClockDiv(255); - + Serial.println(); } void loop() { - // we might need analogSetAttenuation to make the measurement more accurate and less noisy? if (millis() - currTime >= WAIT_TIME) { // non-blocking time delay - // Serial.println(); Serial.print("["); - for (i = 0; i < sizeof(pins)/SIZE_DIV; i++) { - - // float volts = analogRead(pins[i]); - // float result = volts * 3.3 / 4095; - // Serial.print(result); - - float volts = analogReadMilliVolts(pins[i]); - Serial.print(volts); - // Serial.print(61319 * (3.3/volts - 1)); - if (i != sizeof(pins)/SIZE_DIV - 1) { + for (i = 0; i < sizeof(pins) / SIZE_DIV; i++) { + Serial.print(analogReadMilliVolts(pins[i]), DEC); + if (i != sizeof(pins) / SIZE_DIV - 1) { // fence-post the list print Serial.print(", "); } - } Serial.println("]"); - // Serial.println(analogReadMilliVolts(SENSOR1)); - currTime = millis(); + currTime = millis(); } - } \ No newline at end of file From 4f940ecc4006b88c55351be222250bc5a3fd133b Mon Sep 17 00:00:00 2001 From: indohito <107958888+indohito@users.noreply.github.com> Date: Tue, 16 Aug 2022 13:51:21 -0700 Subject: [PATCH 2/4] Add files via upload --- main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..32e6f25 --- /dev/null +++ b/main.py @@ -0,0 +1,12 @@ +# This is a sample Python script. +import requests +from zipfile import ZipFile +URL = "https://www.silabs.com/documents/public/software/CP210x_Universal_Windows_Driver.zip" + +response = requests.get(URL) + +open('ESP32driver', 'wb').write(response.content) + +with ZipFile('ESP32driver', 'r') as zipObj: + zipObj.extractall('C:\\Users\\akash\\Downloads\\ESP32driver') + From cc68fbde49fe53feae03399b69e4830d3ab741d4 Mon Sep 17 00:00:00 2001 From: indohito <107958888+indohito@users.noreply.github.com> Date: Tue, 16 Aug 2022 13:51:55 -0700 Subject: [PATCH 3/4] Rename main.py to ESP32Driver.py --- main.py => ESP32Driver.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename main.py => ESP32Driver.py (100%) diff --git a/main.py b/ESP32Driver.py similarity index 100% rename from main.py rename to ESP32Driver.py From 95f8829afe1f9dfb90786f8ba302eb0f2cd6d24d Mon Sep 17 00:00:00 2001 From: indohito <107958888+indohito@users.noreply.github.com> Date: Tue, 16 Aug 2022 13:52:40 -0700 Subject: [PATCH 4/4] Update ESP32Driver.py --- ESP32Driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ESP32Driver.py b/ESP32Driver.py index 32e6f25..0984a8b 100644 --- a/ESP32Driver.py +++ b/ESP32Driver.py @@ -6,7 +6,7 @@ URL = "https://www.silabs.com/documents/public/software/CP210x_Universal_Windows response = requests.get(URL) open('ESP32driver', 'wb').write(response.content) - +# need to change user destination figure out how to get it to downloads with ZipFile('ESP32driver', 'r') as zipObj: zipObj.extractall('C:\\Users\\akash\\Downloads\\ESP32driver')