달력

5

« 2024/5 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

'작품/LED 버스 노선도'에 해당되는 글 4

  1. 2016.02.08 표시부 프로그램 및 완성
  2. 2016.02.08 제어부 케이스 제작
  3. 2016.02.08 표시부 케이스 제작
  4. 2016.02.08 74LS164을 이용한 기본 제어 코드
현재 버스 장류장 안내 장치:



 
Bus Information Board:

 버스 내부에 버스 노선도를 LED를 이용하여 시각효과를 줘봤습니다.
 
토글 스위치는 각각 앞문과 뒷문이 열리는 신호를 의미합니다.
앞문과 뒷문이 모두 열리는 경우, 한칸 시프트 합니다.
 
그런데 만약 버스 기사 아저씨가 정류장 하나를 멈추지 않고
그냥 지나치는 경우가 발생할 수 있습니다.
그런 경우에는 음성신호를 받아서 위치를 한칸 이동하도록 하였습니다.
음성신호가 문이 열리는 신호 없이 연속해서 두번 들어가는 경우, 한칸 시프트 합니다.
 
아싸 상받았닷ㅎㅎㅎ
 
아두이노는 컨트롤부 내부에:
 
 
 
코드:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
const int ser_in = 19;
const int CLK = 18;
const int Tswitch = 1;
const int Pswitch = 0;
const int dir[5] = {13, 14, 15, 16, 17};
const int pos[11] = {2,3,4,5,6,7,8,9,10,11,12};
int p=0; //the number of dir, order from right down to right up is 0,1,2,3,4. 
int moment=0; // although switch is pushed long time, to move only one unit.
int avil=1;
int countPswitch=0;
 
void setup()
{
  pinMode(ser_in, OUTPUT);
  digitalWrite(ser_in, HIGH);
  pinMode(CLK, OUTPUT); 
  for(int i=0; i<5; i++)
     pinMode(dir[i], OUTPUT);
  for(int i=0; i<11; i++)
    pinMode(pos[i], OUTPUT);
  pinMode(Tswitch, INPUT);
  pinMode(Pswitch, INPUT);
  
  //initialize setting display
  display_position_setting(p);
  display_direction_setting(p);
}
 
void loop() 
{
  //Pwitch
  if(digitalRead(Pswitch)==HIGH)
    {avil=1;} //if Pswitch isn't pushed, initialize avail for next Pswitch push.
  if(digitalRead(Pswitch)==LOW && avil == 1)
//because if P Switch is pushed second the series, that is same with Tswitch pushed.
  {
    countPswitch++;
    avil=0; //only for the moment that touch the Pswitch.
  }
 
 
  //seting the OUTPUT pins
  moment=0;//to make possible to move right, 'check' have to be initialized.
  while( digitalRead(Tswitch)==LOW || (digitalRead(Pswitch)&&countPswitch==2) )
  {
    countPswitch=0;
    if(moment==0) // the moment that the switch is pushed.
       {
         moment=1;//if in the state  that is pushed long time, move only one unit
         p++;
         if(p == 21)//over number, initialize
          p=1;
         
         display_position_setting(p);
         display_direction_setting(p);
       }
    if(p<11)
      five_pulse(CLK); // if in the state  that is pushed long time, the LED shift have to continue.
    else
      one_left_pulse(p); 
 }
    if(p<11)
      five_pulse(CLK); // if in the state  that is pushed long time, the LED shift have to continue.
    else
      one_left_pulse(p); 
}
 
void five_pulse(int CLK)
{
  digitalWrite(ser_in, HIGH);
  
  for(int i=0; i<5; i++)
    {
     digitalWrite(CLK, HIGH);
     delay(15);
     digitalWrite(CLK, LOW);
     delay(15);
    }
}
 
void display_direction_setting(int p) //setting 74164 chip.
{
  int d = ((p+1)/2)-1; //the variation for direction pin
  if(d==-1)
     d=0;
  if(d>4)//clock direction
     d=9-d;
   
   for(int i=0; i<5; i++)
     digitalWrite(dir[i], HIGH);//deactivate
    
  digitalWrite(dir[d], LOW); // the state of LOW is active on dir LED.
}
 
void display_position_setting(int num) //setting connecting wire.
{
  if(num>10)
    num = 20-num;
  
  for(int i=0; i<11; i++)
    digitalWrite(pos[i], LOW);//deacitivate MultiLED
    
  digitalWrite(pos[num], HIGH); //activate
}
 
void one_left_pulse(int p) //difficult control 74164 for diffrent direction.
     {
       int d = ((p+1)/2)-1; //the variation for direction pin, d is -1~4, 5~9.
       if(d==-1)
       d=0;
       if(d>4)
       d=9-d;
       
       
               for(int i = 0; i<16; i++)
            {
              digitalWrite(dir[d], HIGH);
              digitalWrite(ser_in, LOW); clock(1);
              digitalWrite(ser_in, HIGH); clock(i);
              digitalWrite(ser_in, LOW); clock(15-i);
              digitalWrite(dir[d], LOW);
             delay(25);
           }
     }
     
 
void clock(int count)//fast clock
{
  for(int i=0; i<count; i++)
  {
    digitalWrite(CLK, HIGH);
    digitalWrite(CLK, LOW);
  }
}

 

 

 

 

다른 버젼들:

'작품 > LED 버스 노선도' 카테고리의 다른 글

제어부 케이스 제작  (0) 2016.02.08
표시부 케이스 제작  (0) 2016.02.08
74LS164을 이용한 기본 제어 코드  (0) 2016.02.08
:
Posted by youjin.A
2016. 2. 8. 21:45

제어부 케이스 제작 작품/LED 버스 노선도2016. 2. 8. 21:45





'작품 > LED 버스 노선도' 카테고리의 다른 글

표시부 프로그램 및 완성  (0) 2016.02.08
표시부 케이스 제작  (0) 2016.02.08
74LS164을 이용한 기본 제어 코드  (0) 2016.02.08
:
Posted by youjin.A
2016. 2. 8. 21:44

표시부 케이스 제작 작품/LED 버스 노선도2016. 2. 8. 21:44

시범 제작

 





케이스 수정본


케이스 시범

 



  




'작품 > LED 버스 노선도' 카테고리의 다른 글

표시부 프로그램 및 완성  (0) 2016.02.08
제어부 케이스 제작  (0) 2016.02.08
74LS164을 이용한 기본 제어 코드  (0) 2016.02.08
:
Posted by youjin.A

 

const int clockPin = 2;
const int switchPin=3;
const int resetPin = 4;
int i;

void setup()
{
  pinMode(clockPin, OUTPUT);
  pinMode(switchPin, INPUT);
  digitalWrite(switchPin, HIGH);
  
  pinMode(resetPin, OUTPUT);
  digitalWrite(resetPin, LOW);
  digitalWrite(resetPin, HIGH);
}

void loop()
{
  if(digitalRead(switchPin)==LOW)
     {
       clock(10);
       i++;
       if(i>40)
       {digitalWrite(resetPin, LOW);
        digitalWrite(resetPin, HIGH);
        i=0;}
     }
}

void clock(int time)
{
  digitalWrite(clockPin, HIGH);
  delay(time);
  digitalWrite(clockPin, LOW);
  delay(time);
}


'작품 > LED 버스 노선도' 카테고리의 다른 글

표시부 프로그램 및 완성  (0) 2016.02.08
제어부 케이스 제작  (0) 2016.02.08
표시부 케이스 제작  (0) 2016.02.08
:
Posted by youjin.A