Anyone know how to connect GY-85 sensor to nodeMCU 1.0 board?
I wantto learn which pin i can connect SDA and SCL pin
Explore... Chat... Share...
Moderator: igrr
#include <Wire.h>
#define SCL_pin 0 // SCL at IO0 as example
#define SDA_pin 2 // SDA at IO2 as example
#define I2C_ADDR 0 // <- The address of your device goes here (see datasheet of the sensor).
void setup() {
delay (1000);
Wire.begin (SDA_pin, SCL_pin); // Init I²C
Wire.setClock (100000); // 100kHz (max 400kHz)
}
void writeSomeStuff() {
Wire.beginTransmission (I2C_ADDR); // Start writing
Wire.write (0); // Write whatever you need to write
Wire.write (0); // (Register addresses, data and stuff)
//...
Wire.endTransmission ();
}
byte readSomeStuff() {
Wire.beginTransmission (I2C_ADDR); // Start writing
Wire.write (0); // Write what you need to write to prepare the device to return data
Wire.endTransmission ();
Wire.requestFrom (I2C_ADDR, 1); // Start reading one byte
if (Wire.available () == 1)
return Wire.read (); // Read one byte
return 0; // something didn't work
}
It takes about 20-25 seconds for home assistant c[…]
I tried to upgrade tof my sonoff basic R2 with the[…]
a problem Perhaps you want to define "Probl[…]
Rebooting your router will not give you a faster I[…]
There are no other notifications from esptool.py i[…]
Using the Arduino IDE, you'll learn how to set up […]
In this project, you will post to Twitter using an[…]
In this project, we will build a water level contr[…]
I guess I'm late, but I had the same problem and f[…]
Last night I received my first D1 Minis for a lear[…]
Although I am aware that this is an old post, I fe[…]