Skip to content

Commit 467597e

Browse files
committed
1
1 parent 69a3685 commit 467597e

12 files changed

+159
-11
lines changed

Diff for: ESP32C3/lux_monitor_websocket/lux_monitor_html.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</table>
5050

5151
<script>
52-
const socket = new WebSocket('ws://192.168.10.18:81/');
52+
const socket = new WebSocket('ws://192.168.8.103:81/');
5353

5454
socket.onmessage = function (event) {
5555
const data = JSON.parse(event.data);

Diff for: ESP32C3/lux_monitor_websocket/lux_monitor_html_with_bg.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
</div>
9191

9292
<script>
93-
const socket = new WebSocket('ws://192.168.10.18:81/');
93+
const socket = new WebSocket('ws://192.168.8.103:81/');
9494

9595
socket.onmessage = function (event) {
9696
const data = JSON.parse(event.data);

Diff for: ESP32C3/lux_monitor_websocket/lux_monitor_html_with_bg_logger.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
<button id="startLoggingBtn" onclick="toggleLogging()">Start Logging</button>
108108

109109
<script>
110-
const socket = new WebSocket('ws://192.168.10.3:81/');
110+
const socket = new WebSocket('ws://192.168.8.103:81/');
111111

112112
let logging = false;
113113
let logContent = "Timestamp,lux1,lux2,lux3,lux4,lux5,tc1,tc2\n";

Diff for: ESP32C3/lux_monitor_websocket/lux_monitor_websocket.ino

+6-8
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ BH1750 lightMeter1;
3434

3535

3636
// Replace with your network credentials
37-
const char* ssid = "Sherdil";
38-
const char* password = "03336830763BB";
37+
const char* ssid = "Sherdil114";
38+
const char* password = "crescent114";
3939

4040
// Set up the WebSocket server
4141
WebSocketsServer webSocketServer = WebSocketsServer(81);
@@ -76,12 +76,12 @@ void setup() {
7676
digitalWrite(lux5_en, HIGH);
7777

7878

79-
//Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN);
80-
//lightMeter1.begin(BH1750::CONTINUOUS_HIGH_RES_MODE, 0X5C);
79+
Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN);
80+
lightMeter1.begin(BH1750::CONTINUOUS_HIGH_RES_MODE, 0X5C);
8181

8282
// Initialize the second MAX6675 sensor
83-
//pinMode(thermoCS2, OUTPUT);
84-
//digitalWrite(thermoCS2, HIGH);
83+
pinMode(thermoCS2, OUTPUT);
84+
digitalWrite(thermoCS2, HIGH);
8585
digitalWrite(lux1_en, LOW);
8686
digitalWrite(lux2_en, LOW);
8787
digitalWrite(lux3_en, LOW);
@@ -93,7 +93,6 @@ void setup() {
9393
void loop() {
9494

9595
// Read BH1750 @ 0X5C Value in Lux
96-
/*
9796
digitalWrite(lux1_en, HIGH);
9897
lux1 = lightMeter1.readLightLevel();
9998
digitalWrite(lux1_en, LOW);
@@ -114,7 +113,6 @@ void loop() {
114113
lux5 = lightMeter1.readLightLevel();
115114
digitalWrite(lux5_en, LOW);
116115

117-
*/
118116

119117
// Read MAX6675 (01) Value in Degree C
120118
tc1 = thermocouple1.readCelsius();

Diff for: ESP32S3/Dev Kit Schematics/ESP32-S3-0702 (9).PNG

2.8 MB
Loading

Diff for: ESP32S3/Dev Kit Schematics/ESP32-S3-Metric.pdf

113 KB
Binary file not shown.

Diff for: ESP32S3/Dev Kit Schematics/ESP32-S3-inch.pdf

114 KB
Binary file not shown.
968 KB
Binary file not shown.

Diff for: ESP32S3/Dev Kit Schematics/YD-ESP32-S3-SCH-V1.4.pdf

419 KB
Binary file not shown.

Diff for: ESP32S3/recursion_example/recursion_example.ino

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <Arduino.h>
2+
3+
// Recursive function to calculate factorial
4+
unsigned int factorial(unsigned int n) {
5+
// Base case: factorial of 0 is 1
6+
if (n == 0) {
7+
return 1;
8+
}
9+
// Recursive case: n! = n * (n-1)!
10+
else {
11+
return n * factorial(n - 1);
12+
}
13+
}
14+
15+
void setup() {
16+
Serial.begin(115200);
17+
18+
unsigned int num = 5000;
19+
unsigned int result = factorial(num);
20+
21+
Serial.printf("Factorial of %u is %u\n", num, result);
22+
}
23+
24+
void loop() {
25+
// Empty loop
26+
}

Diff for: ESP32S3/rtos_pwm_example_1/rtos_pwm_example_1.ino

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#include <Arduino.h>
2+
#include <freertos/FreeRTOS.h>
3+
#include <freertos/task.h>
4+
5+
// Motor 1 configurations
6+
const int motor1PWM = 2;
7+
const int motor1DirFwd = 3;
8+
const int motor1DirBwd = 4;
9+
10+
// Motor 2 configurations
11+
const int motor2PWM = 5;
12+
const int motor2DirFwd = 6;
13+
const int motor2DirBwd = 7;
14+
15+
// Pushbutton and LED configurations
16+
const int pushButton = 8;
17+
const int ledPin = 9;
18+
19+
void taskMotor1(void *parameter) {
20+
pinMode(motor1PWM, OUTPUT);
21+
pinMode(motor1DirFwd, OUTPUT);
22+
pinMode(motor1DirBwd, OUTPUT);
23+
24+
// Set motor 1 PWM frequency and resolution
25+
ledcSetup(0, 20000, 8); // Channel 0, 20 kHz frequency, 8-bit resolution
26+
ledcAttachPin(motor1PWM, 0); // Attach motor 1 PWM to channel 0
27+
28+
while (true) {
29+
// Motor 1 control logic here
30+
digitalWrite(motor1DirFwd, HIGH); // Set direction forward
31+
digitalWrite(motor1DirBwd, LOW);
32+
ledcWrite(0, 128); // Set PWM duty cycle to 50%
33+
34+
vTaskDelay(pdMS_TO_TICKS(50)); // Task delay
35+
}
36+
}
37+
38+
void taskMotor2(void *parameter) {
39+
pinMode(motor2PWM, OUTPUT);
40+
pinMode(motor2DirFwd, OUTPUT);
41+
pinMode(motor2DirBwd, OUTPUT);
42+
43+
// Set motor 2 PWM frequency and resolution
44+
ledcSetup(1, 20000, 8); // Channel 1, 20 kHz frequency, 8-bit resolution
45+
ledcAttachPin(motor2PWM, 1); // Attach motor 2 PWM to channel 1
46+
47+
while (true) {
48+
// Motor 2 control logic here
49+
digitalWrite(motor2DirFwd, HIGH); // Set direction forward
50+
digitalWrite(motor2DirBwd, LOW);
51+
ledcWrite(1, 128); // Set PWM duty cycle to 50%
52+
53+
vTaskDelay(pdMS_TO_TICKS(40)); // Task delay
54+
}
55+
}
56+
57+
void taskPrintPWM(void *parameter) {
58+
while (true) {
59+
60+
Serial.print("Heart Beat>> \n");
61+
62+
vTaskDelay(pdMS_TO_TICKS(1000)); // Task delay
63+
}
64+
}
65+
66+
void taskPushButton(void *parameter) {
67+
pinMode(pushButton, INPUT);
68+
pinMode(ledPin, OUTPUT);
69+
bool isButtonPressed = false;
70+
71+
while (true) {
72+
// Check the push button state
73+
74+
vTaskDelay(pdMS_TO_TICKS(50)); // Task delay
75+
}
76+
}
77+
78+
79+
void setup() {
80+
Serial.begin(115200);
81+
xTaskCreate(taskMotor1, "Motor1Task", 2048, NULL, 4, NULL); // Highest priority
82+
xTaskCreate(taskMotor2, "Motor2Task", 2048, NULL, 3, NULL); // 2nd highest priority
83+
xTaskCreate(taskPrintPWM, "PrintPWMTask", 2048, NULL, 2, NULL); // 3rd highest priority
84+
xTaskCreate(taskPushButton, "PushButtonTask", 2048, NULL, 1, NULL); // Lowest priority
85+
}
86+
87+
void loop() {
88+
// Nothing to do here, tasks are managed by FreeRTOS
89+
}

Diff for: ESP32S3/sketch_aug1a/sketch_aug1a.ino

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <Arduino.h>
2+
#include <FreeRTOS.h>
3+
4+
const int ledPin = 2; // Built-in LED on ESP32-S3 Dev Kit is connected to GPIO 2
5+
6+
void blinkTask(void *pvParameters) {
7+
(void)pvParameters;
8+
9+
pinMode(ledPin, OUTPUT);
10+
11+
while (1) {
12+
digitalWrite(ledPin, HIGH); // Turn on the LED
13+
vTaskDelay(pdMS_TO_TICKS(1000)); // Wait for 1 second
14+
digitalWrite(ledPin, LOW); // Turn off the LED
15+
vTaskDelay(pdMS_TO_TICKS(1000)); // Wait for 1 second
16+
}
17+
}
18+
19+
20+
void loop() {
21+
// Nothing to do here in the loop() function
22+
}
23+
24+
void setupRTOS() {
25+
// Create the LED blink task
26+
xTaskCreatePinnedToCore(blinkTask, "BlinkTask", 2048, NULL, 1, NULL, ARDUINO_RUNNING_CORE);
27+
}
28+
29+
void setup() {
30+
// Setup serial port (if needed)
31+
Serial.begin(115200);
32+
33+
// Setup FreeRTOS tasks
34+
setupRTOS();
35+
}

0 commit comments

Comments
 (0)