This shows you the differences between two versions of the page.
pm:prj2023:tmiu:trafficlightcontroller [2023/05/06 14:12] fabius_sever.pop created |
pm:prj2023:tmiu:trafficlightcontroller [2023/05/29 17:53] (current) fabius_sever.pop |
||
---|---|---|---|
Line 21: | Line 21: | ||
<note tip> | <note tip> | ||
+ | |||
+ | {{:pm:prj2023:tmiu:trafficlightcontrollerdesign.jpg?400|}} | ||
List of components: | List of components: | ||
Line 37: | Line 39: | ||
<note tip> | <note tip> | ||
+ | |||
+ | // Trafic Light Controller with 7 segment display | ||
+ | // Pop Fabius Sever FILS 1221B | ||
+ | |||
+ | #include "SevSeg.h" | ||
+ | |||
+ | SevSeg S; | ||
+ | byte CommonPins[] = {}; | ||
+ | byte SegPins[] = {2,3,4,5,6,7,8}; | ||
+ | |||
+ | int red = 9; | ||
+ | int yellow = 10; | ||
+ | int green=11; | ||
+ | |||
+ | void setup() | ||
+ | { | ||
+ | S.begin(COMMON_CATHODE, 1, CommonPins, SegPins, 1); | ||
+ | |||
+ | pinMode(9, OUTPUT); | ||
+ | pinMode(10, OUTPUT); | ||
+ | pinMode(11, OUTPUT); | ||
+ | |||
+ | digitalWrite(red, HIGH); | ||
+ | } | ||
+ | |||
+ | void loop() | ||
+ | { | ||
+ | for(int i=9; i>=0; i--) | ||
+ | { | ||
+ | disPlay(i); | ||
+ | delay(2000); | ||
+ | if(i<=3) | ||
+ | { | ||
+ | digitalWrite(yellow, HIGH); | ||
+ | digitalWrite(red, LOW); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | digitalWrite(green, HIGH); | ||
+ | digitalWrite(yellow, LOW); | ||
+ | |||
+ | for(int i=9; i>=0; i--) | ||
+ | { | ||
+ | disPlay(i); | ||
+ | delay(2000); | ||
+ | if(i<=3) | ||
+ | { | ||
+ | digitalWrite(yellow, HIGH); | ||
+ | digitalWrite(green, LOW); | ||
+ | } | ||
+ | | ||
+ | } | ||
+ | |||
+ | digitalWrite(red, HIGH); | ||
+ | digitalWrite(yellow, LOW); | ||
+ | digitalWrite(green, LOW); | ||
+ | | ||
+ | | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | void disPlay(int num) | ||
+ | { | ||
+ | S.setNumber(num); | ||
+ | S.refreshDisplay(); | ||
+ | delay(20); | ||
+ | } | ||
+ | |||
+ | |||
The code was written in the Arduino IDE development environment and uses the SevSeg library to control the 7-segment display. | The code was written in the Arduino IDE development environment and uses the SevSeg library to control the 7-segment display. | ||
Line 49: | Line 121: | ||
<note tip> | <note tip> | ||
+ | |||
+ | {{ :pm:prj2023:tmiu:img_7112.jpeg?300 |}} | ||
I have successfully created a functional traffic light controller. The signals from the microcontroller were transmitted correctly to the LEDs, and the 7-segment display showed the corresponding number of seconds for the time interval. I have obtained a product that functions according to the specifications and can be used to control a traffic light. | I have successfully created a functional traffic light controller. The signals from the microcontroller were transmitted correctly to the LEDs, and the 7-segment display showed the corresponding number of seconds for the time interval. I have obtained a product that functions according to the specifications and can be used to control a traffic light. | ||
</note> | </note> | ||
- | ===== Concluzii ===== | ||
===== Download ===== | ===== Download ===== | ||
Line 59: | Line 132: | ||
<note warning> | <note warning> | ||
+ | {{:pm:prj2023:tmiu:pop_fabius_1221b_trafficlightcontroller.rar|}} | ||
</note> | </note> | ||
Line 67: | Line 141: | ||
<note> | <note> | ||
+ | |||
+ | {{:pm:prj2023:tmiu:bibliografie_tlc.txt|}} | ||
</note> | </note> |