3 تا سوییچ یعنی اینکه هر سوییچ یک نوع رقص نور داشته باشد مثلا با زدن سوییچ اول led ها از راست برقصند اگر سوییچ دوم زدیم ازچپ برقصد و اگر سوم را زدیم از وسط برقصد.
ببین این به کارت میاد اینو سال گذشته در اندازه 2در 2 متر ساختیم و شب جشن ولادت دادیم به مسجد محل تا بزنه به دیوار یادش بخیر خیلی ترکوند :wow:
http://rapidshare.com/files/115054039/flasher1.rar.html
ولی اونی که برای پایان کار ساختیم داخل مدار ش کلی تغیرات دادیم
متاسفانه از آنجایی که استاد من وقت نکرد avr رو کامل درس بده و پروگرام کردن اون هم به ما نگفته من توانایی طراحی این مدار رو ندارم این مدار باید با زبان basic بنویسم و 3 نوع رقص مختلف داشته باشد که به ازای هر نوع رقص یک کلید داریم یعنی مدار باید 3 کلید داشته باشد.
خوب می تونید از دستور if استفاده کنید.
مثلا :( پین های b.0 , b.1 , b.2 رو ورودی کلید ها قرار می دهیم )
config pinb.0=input
config pinb.1=input
config pinb.2=input
config portd=output 'پورت d که دارای 8 خروجی است برای خروجی قرار می دهیم
'-------------------------------------- START ---------------------------------------'
do
if pinb.0=&hff then
portd.0 = 1
portd.1=0
portd.2=1
portd.3=0
...
waitms 150
portd.0=0
portd.1=1
...
elseif pinb.1=1 then
portd=1
wait 1
portd=0
waitms 20
portd=1
waitms 20
portd=0
...
endif
loop
end
سلام
این برنامه
$regfile = "m16def.dat"
$crystal = 8000000
Config Portd = Output
Config Portc = Input
Dim A As Byte
Portd = A
A = &H00
Q:
If Pinc.0 = 1 Then
Goto B1
End If
If Pinc.1 = 1 Then
Goto B2
End If
If Pinc.2 = 1 Then
Goto B3
End If
Goto Q
B1:
If Pinc.2 = 1 Then
Goto B3
End If
If Pinc.1 = 1 Then
Goto B2
End If
Toggle Portd
Waitms 300
Toggle Portd
Waitms 300
Goto B1
B2:
If Pinc.0 = 1 Then
Goto B1
End If
If Pinc.2 = 1 Then
Goto B3
End If
Set Portd.0
Waitms 200
Reset Portd.1
Waitms 200
Set Portd.2
Waitms 200
Reset Portd.3
Waitms 200
Set Portd.4
Waitms 200
Reset Portd.5
Waitms 200
Set Portd.6
Waitms 200
Reset Portd.7
Waitms 200
Set Portd.1
Waitms 200
Reset Portd.0
Waitms 200
Set Portd.3
Waitms 200
Reset Portd.2
Waitms 200
Set Portd.5
Waitms 200
Reset Portd.4
Waitms 200
Set Portd.7
Waitms 200
Reset Portd.6
Waitms 200
Goto B2
B3:
If Pinc.0 = 1 Then
Goto B1
End If
If Pinc.1 = 1 Then
Goto B2
End If
Set Portd.0
Waitms 200
Set Portd.1
Waitms 200
Set Portd.2
Waitms 200
Set Portd.3
Waitms 200
Set Portd.4
Waitms 200
Set Portd.5
Waitms 200
Set Portd.6
Waitms 200
Set Portd.7
Waitms 200
Reset Portd.0
Waitms 200
Reset Portd.1
Waitms 200
Reset Portd.2
Waitms 200
Reset Portd.3
Waitms 200
Reset Portd.4
Waitms 200
Reset Portd.5
Waitms 200
Reset Portd.6
Waitms 200
Reset Portd.7
Waitms 200
دیدگاه