this project is continue. | ||
| ||
. | ||
.. | ||
*MotorsI give motors by Fırat DEDE's website. Japan Autotrol 15:1 12V 746 Rpm http://www.robotus.net/motor/motor.asp motors are 10 mA *batteryI give Battery by türkkuşu of Türk Hava Kurumu.(bataryalar/li-po) http://modelucak.thk.org.tr/satis1/satis.php battry is lityum polimer 7.4 volt 1000 mA. I will ally to battery and total 14.8 volt *SensorsSensor is cny70. 4 front 4 back | ||
*Program (proton-basic)
Device = 16F876AXTAL = 20
ALL_DIGITAL = trueTRISA=255
TRISB=255TRISC=0
Declare CCP1_PIN PORTC.1
Declare CCP2_PIN PORTC.2
Dim HATA As ByteDim YON As Byte
Dim SAGPWM As DWord
Dim SOLPWM As DWordYON=1
'SAĞ [B5] [B2] [B0] [B1] [B3] [B6] SOL'SOLPWM ----> SAĞ
'SAGPWM ----> SOL
BASLA:
'black to white (siyah-beyaz)If PORTB.7=1 And PORTB.2=1 And PORTB.0=0 And PORTB.1=0 And PORTB.3=1 And PORTB.6=1 Then GoSub DUZ
If PORTB.7=1 And PORTB.2=1 And PORTB.0=0 And PORTB.1=1 And PORTB.3=1 And PORTB.6=1 Then GoSub SAG1If PORTB.7=1 And PORTB.2=0 And PORTB.0=0 And PORTB.1=1 And PORTB.3=1 And PORTB.6=1 Then GoSub SAG2If PORTB.7=1 And PORTB.2=0 And PORTB.0=1 And PORTB.1=1 And PORTB.3=1 And PORTB.6=1 Then GoSub SAG3
If PORTB.7=0 And PORTB.2=1 And PORTB.0=1 And PORTB.1=1 And PORTB.3=1 And PORTB.6=1 Then GoSub SAG4
If PORTB.7=1 And PORTB.2=1 And PORTB.0=1 And PORTB.1=0 And PORTB.3=1 And PORTB.6=1 Then GoSub SOL1
If PORTB.7=1 And PORTB.2=1 And PORTB.0=1 And PORTB.1=0 And PORTB.3=0 And PORTB.6=1 Then GoSub SOL2If PORTB.7=1 And PORTB.2=1 And PORTB.0=1 And PORTB.1=1 And PORTB.3=0 And PORTB.6=1 Then GoSub SOL3
If PORTB.7=1 And PORTB.2=1 And PORTB.0=1 And PORTB.1=1 And PORTB.3=1 And PORTB.6=0 Then GoSub SOL4'white to black (beyaz-siyah)
If PORTB.7=0 And PORTB.2=0 And PORTB.0=1 And PORTB.1=1 And PORTB.3=0 And PORTB.6=0 Then GoSub DUZIf PORTB.7=0 And PORTB.2=0 And PORTB.0=1 And PORTB.1=0 And PORTB.3=0 And PORTB.6=0 Then GoSub SAG1
If PORTB.7=0 And PORTB.2=1 And PORTB.0=1 And PORTB.1=0 And PORTB.3=0 And PORTB.6=0 Then GoSub SAG2If PORTB.7=0 And PORTB.2=1 And PORTB.0=0 And PORTB.1=0 And PORTB.3=0 And PORTB.6=0 Then GoSub SAG3
If PORTB.7=1 And PORTB.2=0 And PORTB.0=0 And PORTB.1=0 And PORTB.3=0 And PORTB.6=0 Then GoSub SAG4If PORTB.7=0 And PORTB.2=0 And PORTB.0=0 And PORTB.1=1 And PORTB.3=0 And PORTB.6=0 Then GoSub SOL1
If PORTB.7=0 And PORTB.2=0 And PORTB.0=0 And PORTB.1=1 And PORTB.3=1 And PORTB.6=0 Then GoSub SOL2
If PORTB.7=0 And PORTB.2=0 And PORTB.0=0 And PORTB.1=0 And PORTB.3=1 And PORTB.6=0 Then GoSub SOL3If PORTB.7=0 And PORTB.2=0 And PORTB.0=0 And PORTB.1=0 And PORTB.3=0 And PORTB.6=1 Then GoSub SOL4
' IF YON=2 THEN GOSUB bekle' IF PORTB.7=0 AND PORTB.2=0 AND PORTB.0=0 AND PORTB.1=0 AND PORTB.3=0 AND PORTB.6=0 THEN HPWM 2,255,20000 : HPWM 1,255,20000 :DELAYMS 350 ' GOSUB say
' IF YON=4 THEN GOSUB bekle
' IF YON=4 THEN GOSUB dur
HPWM 2,SAGPWM,20000HPWM 1,SOLPWM,20000
GoTo BASLA
bekle:
DelayMS 10
SAGPWM=195
SOLPWM=200
Return
say:
YON=YON + 1
DelayMS 10
Return
dur:
SAGPWM=0
SOLPWM=0
HPWM 2,SAGPWM,20000
HPWM 1,SOLPWM,20000
GoTo dur
DUZ:
SAGPWM=255
SOLPWM=255
Return
SOL1:
SAGPWM=254
SOLPWM=220
' YON=1
ReturnSOL2:
SAGPWM=254
SOLPWM=160
' YON=1
ReturnSOL3:
SAGPWM=254
SOLPWM=100
' YON=1
ReturnSOL4:
SAGPWM=254
SOLPWM=0
Return
SAG4:
SAGPWM=0
SOLPWM=254
Return
SAG3:
SAGPWM=100
SOLPWM=254
' YON=2
ReturnSAG2:
SAGPWM=160
SOLPWM=254
' YON=2
ReturnSAG1:
SAGPWM=220
SOLPWM=254
' YON=2
Return
- CPU: 16f876A
- Power source: 2x 7.4 Volt 1000mA lityum polimer
- Programming language: c or basic
- Sensors / input devices: CNY70
This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/my-second-line-follower-robot-dortteker-fourwheel