Commit 6df1ffcf authored by Boteju W.J.M.'s avatar Boteju W.J.M.

10/17-Arduino

parent d9cfe200
Pipeline #1737 failed with stages
#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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment