Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
IOT Code
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lui.bingham
IOT Code
Commits
31ab4980
Commit
31ab4980
authored
Jan 15, 2024
by
lui.bingham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WiFi Connect Code Upload
parent
a7b1f97c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
WiFi_Connect.ino
WiFi_Connect.ino
+47
-0
No files found.
WiFi_Connect.ino
0 → 100644
View file @
31ab4980
#include <SoftwareSerial.h>
#include <stdlib.h>
SoftwareSerial
ESP8266
(
4
,
5
);
// RX, TX
unsigned
char
check_connection
=
0
;
unsigned
char
times_check
=
0
;
void
setup
()
{
Serial
.
begin
(
115200
);
ESP8266
.
begin
(
115200
);
ESP8266
.
print
(
"***VER:"
);
delay
(
2000
);
ESP8266
.
println
(
"AT+RST"
);
delay
(
1000
);
ESP8266
.
println
(
"AT+GMR"
);
delay
(
1000
);
ESP8266
.
println
(
"AT+CWMODE=3"
);
delay
(
1000
);
ESP8266
.
println
(
"AT+CWLAP"
);
delay
(
1000
);
}
void
loop
()
{
Serial
.
println
(
"Connecting to Wifi"
);
while
(
check_connection
==
0
)
{
Serial
.
print
(
"."
);
ESP8266
.
print
(
"AT+CWJAP=
\"
Home
\"
,
\"
Endeavour21
\"\r\n
"
);
ESP8266
.
setTimeout
(
5000
);
if
(
ESP8266
.
find
(
"WIFI CONNECTED
\r\n
"
)
==
1
)
{
Serial
.
println
(
"WIFI CONNECTED"
);
break
;
}
times_check
++
;
if
(
times_check
>
3
)
{
times_check
=
0
;
Serial
.
println
(
"Trying to Reconnect.."
);
}
}
while
(
1
);
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment