CONTROL MOBIL-MOBILAN DENGAN REMOTE TV
saya membuat mobil-mobilan yang bisa dikendalikan dengan remote tv ini karena permintaan teman saya,hihii , mobil-mobilan ini berisikan minimum sistem atmega16 , driver motor L293D dan 1buah IR receiver TV, program menggunakan bascom AVR , untuk gearbox menggunakan bahan acrilic untuk gear dan pemegang/dudukan motor.
gambar mobil-mobilannya
untuk gearbox yang digunakan dalam mobil-mobilan ini menggunakan bahan acrilic untuk gear dan pemegang/dudukan motor. untuk remote TV yang digunakan baru bisa berfungsi dengan remote sony saja.
gear ,veleg, ban
untuk skemanya sangat simple, hanya beisi rangkaian regulator 7805, sistem minimum atmega16, driver motor dan ir receiver TV
cek videonya disini
PROGRAM DENGAN BASCOM AVR
$regfile = "m16def.dat"
$crystal = 16000000Config Portd.1 = Output
Config Portd.2 = Output
Config Portd.6 = Output
Config Portd.7 = Output
Motor1a Alias Portd.1
Motor1b Alias Portd.2
Motor2a Alias Portd.6
Motor2b Alias Portd.7
Motor1a = 0
Motor1b = 0
Motor2a = 0
Motor2b = 0
Declare Sub Maju
Declare Sub Belok_kiri
Declare Sub Belok_kanan
Declare Sub Berhenti
Declare Sub Mundur
Config Timer1 = Pwm , Pwm = 8 , Prescale = 256 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up
Dim Datas(14) As Byte , Starts As Byte , Count2 As Byte , Ir_data As Byte , N As Byte
Remote:
Config Pind.3 = Input
Set Portd.3
Pin_ir Alias Pind.3
Count2 = 0
Do
Ir_data = 0
Gosub Baca_ir
If Ir_data = 244 Then Call Maju
If Ir_data = 179 Then Call Belok_kanan
If Ir_data = 180 Then Call Belok_kiri
If Ir_data = 245 Then Call Mundur
If Ir_data = 0 Then Call Berhenti
Loop
Baca_ir:
While Pin_ir = 1
Wend
While Pin_ir = 0
Waitus 100
Incr Count2
Wend
Starts = Count2
Count2 = 0
If Starts = 25 Then
For N = 1 To 14
While Pin_ir = 1
Wend
While Pin_ir = 0
Waitus 100
Incr Count2
Wend
Datas(n) = Count2
Count2 = 0
Next
For N = 1 To 8
Datas(n) = Datas(n) / 5
Datas(n) = Datas(n) - 1
Next
Datas(1) = Datas(1) * 1
Datas(2) = Datas(2) * 2
Datas(3) = Datas(3) * 4
Datas(4) = Datas(4) * 8
Datas(5) = Datas(5) * 16
Datas(6) = Datas(6) * 32
Datas(7) = Datas(7) * 64
Datas(8) = Datas(8) * 128
Ir_data = 0
For N = 1 To 8
Ir_data = Ir_data + Datas(n)
Next
End If
Return
Sub Berhenti
Motor1a = 0
Motor1b = 0
Motor2a = 0
Motor2b = 0
Pwm1a = 0
Pwm1b = 0
Ir_data = 0
End Sub
Sub Maju
Motor1a = 1
Motor1b = 0
Motor2a = 1
Motor2b = 0
Pwm1a = 110
Pwm1b = 110
Waitms 200
Motor1a = 0
Motor1b = 0
Motor2a = 0
Motor2b = 0
Pwm1a = 0
Pwm1b = 0
Ir_data = 0
End Sub
Sub Mundur
Motor1a = 0
Motor1b = 1
Motor2a = 0
Motor2b = 1
Pwm1a = 130
Pwm1b = 130
Waitms 200
Motor1a = 0
Motor1b = 0
Motor2a = 0
Motor2b = 0
Pwm1a = 0
Pwm1b = 0
Ir_data = 0
End Sub
Sub Belok_kanan
Motor1a = 1
Motor1b = 0
Motor2a = 1
Motor2b = 0
Pwm1a = 0
Pwm1b = 150
Waitms 200
Motor1a = 0
Motor1b = 0
Motor2a = 0
Motor2b = 0
Pwm1a = 0
Pwm1b = 0
Ir_data = 0
End Sub
Sub Belok_kiri
Motor1a = 1
Motor1b = 0
Motor2a = 1
Motor2b = 0
Pwm1a = 150
Pwm1b = 0
Waitms 200
Motor1a = 0
Motor1b = 0
Motor2a = 0
Motor2b = 0
Pwm1a = 0
Pwm1b = 0
Ir_data = 0
End Sub
bang bisa kirim image fcbnya ga yg dah jadi saya minta sih bang pengen nih tertarik melihatnya tolong yah bang mau bikin sendiri ga ngrti bang
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteKog ndak pake timer bang? Cara baca IR nya
ReplyDelete