How to measure gravity, free fall velocity and free fall time with arduino
Автор: Robotica DIY
Загружено: 2019-09-02
Просмотров: 8400
How to measure gravity, free fall velocity and free fall time with arduino
Scroll down for code.....
Please like & Subscribe for more videos
LiquidCrystal_I2C library Github link
https://github.com/fdebrabander/Ardui...
I2C scanner to find out I2C address
http://playground.arduino.cc/Main/I2c...
If you want to support my video please buy any product through my amazon affiliate link. I will receive a commission, at no extra cost to you.
LIST OF COMPONENT (affiliate links)
http://amzn.to/2fvSRJq (Arduino)
https://amzn.to/2ZJNHe7 (IR sensor)
http://amzn.to/2zg8aeX (I2C)
http://amzn.to/2yBk7eT (LCD display)
http://amzn.to/2wxPmWz (Breadboard)
http://amzn.to/2vJ3lvo (Jumper wire)
Song: Extenz - Gravity (Vlog No Copyright Music)
Music provided by Vlog No Copyright Music.
Video Link: • Extenz - Gravity (Vlog No Copyright Music)
#include (Wire.h) //instead of parenthesis () put angle bracket as YouTube description does not allow angle bracket
#include (LiquidCrystal_I2C.h)
// Set the LCD address to 0x3F for a 16 chars and 2 line display // note: it may be different for your LCD please find it.
LiquidCrystal_I2C lcd(0x3F, 16, 2);
const int IR_Sensor1=2;
const int IR_Sensor2=7;
double startMillis;
double endMillis;
double free_fall_time;
double h = 1.41;
double g,v;
int activate=0;
void setup() {
//Pin 2 is connected to the output of proximity sensor
pinMode(IR_Sensor1,INPUT);
pinMode(IR_Sensor2,INPUT);
// initialize the LCD
lcd.begin();
lcd.setCursor(0, 0);
lcd.print("T:");
lcd.setCursor(8, 0);
lcd.print("V:");
lcd.setCursor(0, 1);
lcd.print("Gravity:");
}
void loop() {
if(digitalRead(IR_Sensor1)==LOW) //Check the sensor output
{
//lcd.clear();
startMillis = millis();
activate=0;
}
if(digitalRead(IR_Sensor2)==LOW) //Check the sensor output
if (activate==0){
{
endMillis = millis();
free_fall_time = (endMillis-startMillis)/1000;
lcd.setCursor(2, 0);
lcd.print(free_fall_time);
lcd.setCursor(6, 0);
lcd.print("s");
g = 2*h/pow(free_fall_time, 2); // gravity
v = g*free_fall_time; // free fall velocity
lcd.setCursor(10, 0);
lcd.print(v);
lcd.setCursor(13, 0);
lcd.print("m/s");
lcd.setCursor(8, 1);
lcd.print(g);
lcd.setCursor(12, 1);
lcd.print("m/s2");
activate=1;
}
}
}
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: