beginner projects: #arduino LCD project

preview_player
Показать описание
1. Put the ADXL345 acceleration sensor on the breadboard
2. Connect the Vcc and GND pin of the sensor to +5V and GND on Arduino respectively
3. Connect SDA and SCL pins to A4 and A5 respectively.
4. Connect the Vcc and GND pin of 16x2 i2c LCD to Vin and the GND pin of Arduino
5. Connect the SDA and SCL pins of the LCD to the extended A4 and A5 pins which present above the AREF pin
6. Upload the code (the code is pinned in the first comment)

#shorts #shortsvideo
Рекомендации по теме
Комментарии
Автор

Code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_ADXL345_U.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);
Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified();

void setup() {
lcd.init();
lcd.backlight();
Serial.begin(9600);
if (!accel.begin()) {
Serial.println("No valid sensor found");
while (1);
}
}

void loop() {
sensors_event_t event;
accel.getEvent(&event);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("X:");

lcd.setCursor(8, 0);
lcd.print("Y:");

lcd.setCursor(4, 1);
lcd.print("Z:");

delay(500);
}

THEELECTRONICGUY
Автор

Now make a fall detection system using this

empty
visit shbcf.ru