السلام عليكم ورحمة الله وبركاته
كل عام وانت بألف خير
بدي اطلب منكم مساعدة وبتمنى تساعدوني بأقصى سرعة
بدي مشوع برمجة اشارة مرور بلغة c++ عبر منفذ LPT
كود برمجي ودارة(هاردوير و سوفت وير)
بتمنى يلي بيعرف يساعدني بأقصى سرعة خلال فترة العيد كحد أقصى
وبتمنى يلي بيعرف يرسليا
كل عام وانت بالف خير
اتفضل
// TrafficLight.h file
#ifndef TRAFFIC_LIGHT_CLASS_DEFINED
#define TRAFFIC_LIGHT_CLASS_DEFINED
class TrafficLight
{
public:
enum LightState {RED = 0, YELLOW, GREEN};
public:
TrafficLight();
void Advance();
void Wait();
char* CurrentState();
private:
LightState m_state;
int m_Delay[3];
};
#endif
// TrafficLight.cpp file
#include “Windows.h”
#include “TrafficLight.h”
TrafficLight::TrafficLight()
{
m_state = RED;
m_Delay[ RED ] = 10 * 1000; // msec value
m_Delay[ YELLOW ] = 4 * 1000; // msec value
m_Delay[ GREEN ] = 15 * 1000; // msec value
};
void TrafficLight::Advance()
{
switch (m_state)
{
case RED: m_state = GREEN; break;
case YELLOW: m_state = RED; break;
case GREEN: m_state = YELLOW; break;
}
};
void TrafficLight::Wait()
{
Sleep(m_Delay[m_state]);
};
char* TrafficLight::CurrentState()
{
switch (m_state)
{
case RED: return “Red”; break;
case YELLOW: return “Yellow”; break;
case GREEN: return “Green”; break;
}
return "Error";
}
// LightSim.cpp file
// LightSim.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include “TrafficLight.h”
int main(int argc, char* argv[])
{
TrafficLight light1;
while (1)
{
printf("Light is currently %s
", light1.CurrentState());
light1.Wait();
light1.Advance();
};
return 0;
}
في برضه مواقع اجنبية متخصصة فقط في السي ++ والمشروع ده مر كتير هناك تقدر برضه تشوف هناك عن طريق البحث على اسم المشروع بلانجليزى برضه تنويع وتشوف مختلف الافكار وطرق التصميم ده بعد مساعده اخى روبوت الاسلام:)