اصلاح اختبار كتابي عدد 01 : 9 اساسي
التلوين التام للقطعة 4 و 5 اصلاح تمرين الرسم التقني للقطعة عدد 2 و القطعة من مادة النحاس مادة القطعة تحدد من خلال التخديش في الصفحة الاولى من الاختبار
نادي التكنولوجيا تحت اشراف الاستاذ فتحي ميدوني و يهدف لتنمية قدرات التلاميذ في مجال التكنولوجيا و الابداع
في عصر التكنولوجيا المتقدمة، أصبحت الأنظمة الذكية جزءًا لا يتجزأ من حياتنا اليومية. واحدة من هذه الأنظمة هي "بوابة مأوى السيارات"، وهي نظام يتم استخدامه لإدارة دخول وخروج السيارات من المواقف أو المآوي بشكل آلي. في هذا المقال، سنقوم بتصميم نظام بوابة مأوى سيارات باستخدام لوحة Arduino ومكونات أخرى مثل مستشعر الحركة (PIR Sensor) ومحرك صغير.
النظام الذي سنتطرق إليه يقوم بالتحكم في فتح وإغلاق البوابة تلقائيًا عند اكتشاف حركة سيارة أمامها. يستخدم النظام مستشعر الحركة للكشف عن وجود السيارة، ثم يرسل إشارة إلى المحرك ليقوم بفتح البوابة. بعد مرور السيارة، يتم إغلاق البوابة تلقائيًا.
// Defining Pins
const int pirPin = 2; // PIR sensor connected to PIN 2
const int motorSpeedPin = 9; // Motor speed control connected to PIN 9
const int motorDirPin1 = 10; // Motor direction control 1 connected to PIN 10
const int motorDirPin2 = 11; // Motor direction control 2 connected to PIN 11
void setup() {
Serial.begin(9600); // Start serial communication for debugging
pinMode(pirPin, INPUT); // Set PIR pin as input
pinMode(motorSpeedPin, OUTPUT); // Set motor speed pin as output
pinMode(motorDirPin1, OUTPUT); // Set motor direction pin 1 as output
pinMode(motorDirPin2, OUTPUT); // Set motor direction pin 2 as output
}
void loop() {
int pirValue = digitalRead(pirPin); // Read the value from PIR sensor
if (pirValue == HIGH) { // If motion is detected
Serial.println("Motion Detected! Opening Gate...");
openGate(); // Open the gate
delay(5000); // Wait for 5 seconds (time for car to pass)
closeGate(); // Close the gate
} else {
Serial.println("No Motion Detected.");
}
delay(100); // Small delay between readings
}
// Function to open the gate
void openGate() {
digitalWrite(motorSpeedPin, 255); // Set motor speed to maximum
digitalWrite(motorDirPin1, HIGH); // Set motor direction to forward
digitalWrite(motorDirPin2, LOW);
delay(2000); // Keep the gate open for 2 seconds (adjust as needed)
stopMotor(); // Stop the motor
}
// Function to close the gate
void closeGate() {
digitalWrite(motorSpeedPin, 255); // Set motor speed to maximum
digitalWrite(motorDirPin1, LOW); // Set motor direction to reverse
digitalWrite(motorDirPin2, HIGH);
delay(2000); // Keep the gate closed for 2 seconds (adjust as needed)
stopMotor(); // Stop the motor
}
// Function to stop the motor
void stopMotor() {
digitalWrite(motorSpeedPin, 0); // Stop the motor
}
digitalRead(pirPin)
. إذا كانت القيمة HIGH، فهذا يعني أن هناك حركة.digitalWrite
لتحديد السرعة والاتجاه. يتم ترك المحرك يعمل لمدة 2 ثانية لفتح البوابة.stopMotor
.
تعليقات
إرسال تعليق