Das ist der SystemCHeck den ich verwende:
Code:
#define PWM_IR 35
#define IR_left 27
#define IR_right 29
#define TSOP 26
Dim Text(40) As Char
Sub main()
PRO_BOT128_INIT()
Port_DataDirBit(IR_left,PORT_OUT)
Port_DataDirBit(IR_right,PORT_OUT)
Port_DataDirBit(TSOP,PORT_IN)
Timer_T3PWM(51,25,PS_8)
AbsDelay(500)
Do While True
Port_WriteBit(IR_left,PORT_OFF)
Port_WriteBit(IR_right,PORT_ON)
AbsDelay(5)
If Port_ReadBit(TSOP) = 0 Then
Text = "Object right"
Msg_WriteText(Text)
Msg_WriteChar(13)
AbsDelay(500)
End If
AbsDelay(100)
Port_WriteBit(IR_left,PORT_ON)
Port_WriteBit(IR_right,PORT_OFF)
AbsDelay(5)
If Port_ReadBit(TSOP) = 0 Then
Text = "Object left"
Msg_WriteText(Text)
Msg_WriteChar(13)
AbsDelay(500)
End If
AbsDelay(100)
End While
End Sub
Lesezeichen