ايران ويج

نسخه‌ی کامل: برنامه ربات مسير ياب5سنسوره
شما در حال مشاهده‌ی نسخه‌ی متنی این صفحه می‌باشید. مشاهده‌ی نسخه‌ی کامل با قالب بندی مناسب.
صفحه‌ها: 1 2
(۲۳-فروردین-۱۳۹۳, ۱۴:۴۳:۴۹)a.mehran نوشته است: [ -> ]ممنون . یه سوال پایه یک lm324 رو هواست ؟

این pcb یکم مجهول نیست؟

سنسور هارو هشت بچینم یا تو یه ردیف ؟ لطفا کمکم کنید امروز باید ربات مسیر یابمو تکمیلش کنم

توی یه مسیر بچینین که خوب نیست چون زاویه و ... نمیتونه تشخیص بده میتونین مثلا اینطوری بچینین :...:
اما بهترین حالت فکر میکنم همون 8 فارسیه

چیه pcb مجهوله؟!
اون 123تا9 چیه ؟ ممنون میشم بیشتر توضیح بدین

گیرنده مادون قرمز رو چجوری بزنم به آی سی ؟
در مورد lm324 باید بگم که من قبلا یه کم بد کشیدم پایه 1 میره به میکرو 3 به سنسور و 2 هم به پتانسیومتر

(۲۳-فروردین-۱۳۹۳, ۲۱:۲۲:۵۱)a.mehran نوشته است: [ -> ]اون 123تا9 چیه ؟ ممنون میشم بیشتر توضیح بدین

فکر میکنم منظورتون اون برد سنسورهاست درسته؟!
من اینارو برای جای کابل ها گذاشتم
ممنون
من از فرستنده و گیرنده مادون قرمز استفاده کردم و cny70نزاشتم . گیرنده مادون رو چجوری وصل کنم ؟

پس من اینارو به شماره خودش وصل کنم ؟ www.iranled.com/forum/attachment.php?aid=11435
فرستنده-گیرنده
خیلی ممنون.
ببخشید یکم زیادی سوال میپرسم
نه خواهش میکنم منم چیزهایی که بلدم از بچه های اینجا یاد گرفتم
کد:
$regfile = "m16def.dat"
$crystal = 1000000
'==============================================================================
Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down , Prescale = 64
Config Portd = Output
Config Porta = Input
'==============================================================================
Dim A As Word
Dim B As Word
A = Pwm1a
B = Pwm1b
'==============================================================================
Do
'============================= jolo ===========================================
If Pina.2 = 1 And Pina.4 = 0 And Pina.0 = 0 Then
Portd = &B00000101
A = 1023
B = 1023
Elseif Pina.0 = 0 And Pina.2 = 0 And Pina.1 = 0 And Pina.3 = 0 And Pina.4 = 0 Then
Portd = &B00000000
End If

If Pina.1 = 1 And Pina.4 = 0 And Pina.0 = 0 Then
Portd = &B00000101
A = 1023
B = 1023
Elseif Pina.0 = 0 And Pina.1 = 0 And Pina.2 = 0 And Pina.3 = 0 And Pina.4 = 0 Then
Portd = &B00000000
End If

If Pina.3 = 1 And Pina.4 = 0 And Pina.0 = 0 Then
Portd = &B00000101
A = 1023
B = 1023
Elseif Pina.0 = 0 And Pina.1 = 0 And Pina.2 = 0 And Pina.3 = 0 And Pina.4 = 0 Then
Portd = &B00000000
End If

If Pina.2 = 1 And Pina.1 = 1 And Pina.4 = 0 And Pina.0 = 0 Then
Portd = &B00000101
A = 1023
B = 1023
Elseif Pina.0 = 0 And Pina.1 = 0 And Pina.2 = 0 And Pina.3 = 0 And Pina.4 = 0 Then
Portd = &B00000000
End If

If Pina.2 = 1 And Pina.3 = 1 And Pina.4 = 0 And Pina.0 = 0 Then
Portd = &B00000101
A = 1023
B = 1023
Elseif Pina.0 = 0 And Pina.1 = 0 And Pina.2 = 0 And Pina.3 = 0 And Pina.4 = 0 Then
Portd = &B00000000
End If

'=============================enheraf b chap===================================

If Pina.0 = 1 And Pina.1 = 1 Then
Portd = &B00000001
Elseif Pina.0 = 0 And Pina.1 = 0 And Pina.2 = 0 And Pina.3 = 0 And Pina.4 = 0 Then
Portd = &B00000000
End If

If Pina.0 = 1 Then
Portd = &B00000001
Elseif Pina.0 = 0 And Pina.1 = 0 And Pina.2 = 0 And Pina.3 = 0 And Pina.4 = 0 Then
Portd = &B00000000
End If

'=============================enheraf b rast===================================

If Pina.4 = 1 And Pina.3 = 1 Then
Portd = &B00000100
Elseif Pina.0 = 0 And Pina.1 = 0 And Pina.2 = 0 And Pina.3 = 0 And Pina.4 = 0 Then
Portd = &B00000000
End If

If Pina.4 = 1 Then
Portd = &B00000100
Elseif Pina.0 = 0 And Pina.1 = 0 And Pina.2 = 0 And Pina.3 = 0 And Pina.4 = 0 Then
Portd = &B00000000
End If

Loop
[hr]
$regfile = "m32def.dat"
$crystal = 8000000

'***************************
Config Portd = Output
Config Portb = Input

'********************************
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Porta.2 , Db5 = Porta.3 , Db6 = Porta.4 , Db7 = Porta.5 , E = Porta.1 , Rs = Porta.0

Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down , Prescale = 64



S1 Alias Pinb.0
S2 Alias Pinb.1
S3 Alias Pinb.2
S4 Alias Pinb.3
S5 Alias Pinb.4
S6 Alias Pinb.5
S7 Alias Pinb.6
Declare Sub Sefid
Declare Sub Forward
Declare Sub Left1
Declare Sub Right1
Declare Sub Left2
Declare Sub Right2
Declare Sub Left3
Declare Sub Right3
M1 Alias Portd.6
'M1b Alias Portd.7
M2 Alias Portd.5
'M2b Alias Portd.4


'M1b = 0
'M2b = 0

  Cls

Lcd "Robot MasirYab"
Locate 2 , 1
Lcd " s. hashem.h "
Do





If S1 = 0 And S2 = 0 And S3 = 0 And S4 = 0 And S5 = 0 And S6 = 0 And S7 = 0 Then Call Sefid
If S4 = 1 Then Call Forward
If S4 = 1 And S3 = 1 Then Call Forward
If S4 = 1 And S2 = 1 Then Call Forward
If S4 = 1 And S5 = 1 Then Call Forward
If S4 = 1 And S6 = 1 Then Call Forward
If S5 = 1 And S3 = 1 Then Call Forward
If S6 = 1 And S2 = 1 Then Call Forward
If S3 = 1 And S5 = 1 And S6 = 1 And S2 = 1 Then Call Forward


If S3 = 1 And S5 = 0 Then Call Left1
If S2 = 1 And S6 = 0 Then Call Left1
If S1 = 1 And S7 = 0 Then Call Left1

If S5 = 1 And S3 = 0 Then Call Right1
If S6 = 1 And S2 = 0 Then Call Right1
If S7 = 1 And S1 = 0 Then Call Right1


   'masir siyah
If S1 = 1 And S2 = 1 And S3 = 1 And S4 = 0 And S5 = 1 And S6 = 1 And S7 = 1 Then Call Forward
If S1 = 1 And S2 = 1 And S3 = 0 And S4 = 1 And S5 = 1 And S6 = 1 And S7 = 1 Then Call Left1
If S1 = 1 And S2 = 0 And S3 = 0 And S4 = 1 And S5 = 1 And S6 = 1 And S7 = 1 Then Call Left1
If S1 = 1 And S2 = 0 And S3 = 0 And S4 = 0 And S5 = 1 And S6 = 1 And S7 = 1 Then Call Left1
If S1 = 1 And S2 = 1 And S3 = 1 And S4 = 1 And S5 = 0 And S6 = 1 And S7 = 1 Then Call Right1
If S1 = 1 And S2 = 1 And S3 = 1 And S4 = 1 And S5 = 1 And S6 = 0 And S7 = 1 Then Call Right1
If S1 = 1 And S2 = 1 And S3 = 1 And S4 = 1 And S5 = 0 And S6 = 0 And S7 = 1 Then Call Right1
Loop
End


'***********************************
Sub Forward

Pwm1a = 250
Pwm1b = 250
Locate 1 , 1
Lcd Pwm1a
Locate 1 , 7
Lcd  Pwm1b
Locate 2 , 7
Lcd "forward"
Return
End Sub

'************************************
Sub Left1

Pwm1a = 100
Pwm1b = 0
Locate 1 , 1
Lcd Pwm1a
Locate 1 , 7
Lcd Pwm1b
Return
End Sub

'*************************************
Sub Left2

Pwm1a = 200
Pwm1b = 50
Return
End Sub
  '*************************************
Sub Left3

Pwm1a = 200
Pwm1b = 70
Return
End Sub
'************************************
Sub Right1

Pwm1a = 0
Pwm1b = 100
Locate 1 , 1
Lcd Pwm1a
Locate 1 , 7
Lcd Pwm1b
Return
End Sub

'*************************************
Sub Right2

Pwm1a = 50
Pwm1b = 200
Return
End Sub
  '*************************************
Sub Right3

Pwm1a = 70
Pwm1b = 200
Return
End Sub
'**************************************
Sub Sefid
    pwm1a=250
Pwm1b = 250
    Lcd " charkhesh"
Wait 3
Pwm1a = 50
Pwm1b = 250
    Lcd " charkhesh"
Wait 1
Pwm1a = 250
Pwm1b = 50
Lcd " charkhesh"
Cls
Wait 1
Return
End Sub
صفحه‌ها: 1 2