ข้ามไปที่เนื้อหาหลัก

ส่งงานครั้งที่ 5

Arduino Ohm Meter
อุปกรณ์
  • Arduino Uno
  • 16*2 LCD display
  • Potentiometer (1 kilo Ohm)
  • Resistors
  • Breadboard
  • Jumper wires
Diagram

Code

#include<LiquidCrystal.h>
LiquidCrystal lcd(2,3,4,5,6,7);   //กำหนดขาLCD
int Vin=5;       
float Vout=0;     
float R1=3300;    
float R2=0; 
int a2d_data=0;    
float buffer=0;            
void setup() 
{
 lcd.begin(16,2); //กำหนดตำแหน่งLCD
}
void loop()
{
  a2d_data=analogRead(A0); //ให้a2d_dataมีค่าเท่ากับค่าที่อ่านได้จากA0
  if(a2d_data)
  {
    buffer=a2d_data*Vin;
    Vout=(buffer)/1024.0;
    buffer=Vout/(Vin-Vout); 
    R2=R1*buffer;
    lcd.setCursor(4,0);
    lcd.print("ohm meter");
    lcd.setCursor(0,1);
    lcd.print("R (ohm) = ");
    lcd.print(R2);   
    delay(1000);
  }
}

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

ส่งงานครั้งที่ 16

Smoke Detector Using MQ2 อุปกรณ์ Arduino UNO Smoke Detector Arduino Shield (Self Designed) Power Supply Smoke Sensor (MQ2) Resistors (10K and 1K) Buzzer 16x2 LCD 10k POT LED LM358 Burg strips Diagram Code #include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2); #define buzzer 9 #define sensor A0   #define load_Res 10   #define air_factor 9.83                                                   float SmokeCurve[3] ={2.3,0.53,-0.44};    // (x, y, slope) x,y พิกัดของจุดหนึ่งและความลาดชันระหว่างสองจุด                                                                                     ...

ส่งงานครั้งที่ 9

Gyro Sensor Interfacing Gyro Sensor  คือเซ็นเซอร์ที่มีไว้สำหรับตรวจจับลักษณะการหมุน โ ดยเป็นการตรวจจับแบบ  3  แกน  (3-Axes) อุปกรณ์ Arduino Uno MPU-6050 10K POT Jumper wire Breadboard USB cable Power supply Diagram Code #include<LiquidCrystal.h> //ประกาศเมื่อใช้จอ LiquidCrystal lcd(8,9,10,11,12,13); //ขาที่ต่อจอ #include <Wire.h> #include <MPU6050.h> #define period 10000 MPU6050 mpu; int count=0; char okFlag=0; byte degree[8] = {   0b00000,   0b00110,   0b01111,   0b00110,   0b00000,   0b00000,   0b00000,   0b00000 }; void setup()  {   lcd.begin(16,2);   lcd.createChar(0, degree);   Serial.begin(9600);   Serial.println("Initialize MPU6050");   while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))   {     lcd.clear();     lcd.print("Device not Found"...

ส่งงานครั้งที่ 15

Arduino Solar Tracker อุปกรณ์ Servo Motor (sg90) Solar panel Arduino Uno LDR’s X 2 (Light Dependent Resistor) 10K resistors X 2 Battery (6 to 12V) Diagram Code #include <Servo.h>      //ประกาศเมื่อมีการใช้Servo Servo sg90;             //ตั้งค่าServoด้วยตัวแปรsg90 int initial_position = 90;   //ประกาศตัวแปรไว้ที่ค่า 90 int LDR1 = A0;          //ขาที่LDRต่อไว้ int LDR2 = A1;          //ขาที่LDR2ต่อไว้ int error = 5;          //ตั้งค่าเริ่มต้นของ error ที่ 5 int servopin=9; void setup() {    sg90.attach(servopin);  // ให้ servo ที่ขา 9   pinMode(LDR1, INPUT);   //ให้ขาที่ต่อกับLDRเป็นInput   pinMode(LDR2, INPUT);   sg90.write(initial_position);   //ขยับServoไว้ที่90องศา   delay(2000);            // กำหนดdelay2วินาที } void loop() {   int ...