Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020-045
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2020-045
2020-045
Commits
6df1ffcf
Commit
6df1ffcf
authored
Oct 17, 2020
by
Boteju W.J.M.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
10/17-Arduino
parent
d9cfe200
Pipeline
#1737
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
10 deletions
+25
-10
Arduino/NodeMCU_MPU6050_WebServer/NodeMCU_MPU6050_WebServer.ino
...o/NodeMCU_MPU6050_WebServer/NodeMCU_MPU6050_WebServer.ino
+25
-10
No files found.
Arduino/
Final_3
.ino
→
Arduino/
NodeMCU_MPU6050_WebServer/NodeMCU_MPU6050_WebServer
.ino
View file @
6df1ffcf
#include <ESP8266WiFi.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ArduinoJson.h>
...
...
@@ -31,9 +31,12 @@ const uint8_t MPU6050_REGISTER_SIGNAL_PATH_RESET = 0x68;
int16_t
AccelX
,
AccelY
,
AccelZ
,
Temperature
,
GyroX
,
GyroY
,
GyroZ
;
/*Put your SSID & Password*/
const
char
*
ssid
=
"CommercePromote"
;
// Enter SSID here
const
char
*
password
=
"Salsa@4321"
;
//Enter Password here
//*Put your SSID & Password*/
//const char* ssid = "CommercePromote"; // Enter SSID here
//const char* password = "Salsa@4321"; //Enter Password here
const
char
*
ssid
=
"SLT_FIBRE@jayamini"
;
const
char
*
password
=
"adsl54321"
;
ESP8266WebServer
server
(
80
);
...
...
@@ -44,7 +47,6 @@ void setup() {
Serial
.
begin
(
9600
);
delay
(
100
);
Serial
.
println
(
"Connecting to "
);
Serial
.
println
(
ssid
);
...
...
@@ -53,8 +55,8 @@ void setup() {
//check wi-fi is connected to wi-fi network
while
(
WiFi
.
status
()
!=
WL_CONNECTED
)
{
Serial
.
print
(
"Wifi Not Successfully Connected."
);
delay
(
1000
);
Serial
.
print
(
"."
);
}
Serial
.
println
(
""
);
Serial
.
println
(
"WiFi connected..!"
);
...
...
@@ -101,13 +103,24 @@ void handle_OnConnect() {
Serial
.
print
(
" Gz: "
);
Serial
.
println
(
Gz
);
delay
(
100
);
String
text
=
"Ax :"
+
String
(
Ax
)
+
" Ay :"
+
String
(
Ay
)
+
" Az :"
+
String
(
Az
)
+
" Gx :"
+
String
(
Gx
)
+
" Gy :"
+
String
(
Gy
)
+
" Gz :"
+
String
(
Gz
);
StaticJsonBuffer
<
200
>
jsonBuffer
;
Serial
.
println
(
Ax
);
// char json[] = "{ \"sensor\":\"gps\" , \"Ax\" : \"{" + String(Ax) + "}\" , \"Ay\":Ay, \"Az\":Az, \"Gx\":Gx, \"Gy\":Gy, \"Gz\":Gz }";
// Serial.println(json);
// JsonObject& root = jsonBuffer.parseObject(json);
// if(!root.success()) {
// Serial.println("parseObject() failed");
// }else{
// Serial.print("Successful \n");
// const char* sensor = root["sensor"];
// Serial.print(sensor);
// }
String
text
=
"Ax :"
+
String
(
Ax
)
+
",Ay :"
+
String
(
Ay
)
+
",Az :"
+
String
(
Az
)
+
",Gx :"
+
String
(
Gx
)
+
",Gy :"
+
String
(
Gy
)
+
",Gz :"
+
String
(
Gz
);
server
.
send
(
200
,
"text/plain"
,
text
);
}
void
handle_NotFound
(){
server
.
send
(
404
,
"text/plain"
,
"Not found"
);
}
...
...
@@ -123,6 +136,8 @@ void I2C_Write(uint8_t deviceAddress, uint8_t regAddress, uint8_t data){
// read all 14 register
void
Read_RawValue
(
uint8_t
deviceAddress
,
uint8_t
regAddress
){
Wire
.
beginTransmission
(
deviceAddress
);
// Wire.beginTransmission(0x68);
Wire
.
write
(
regAddress
);
Wire
.
endTransmission
();
Wire
.
requestFrom
(
deviceAddress
,
(
uint8_t
)
14
);
...
...
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