Witam mam problem odbiorem rc5 w bascomie. Napisałem program i on niby działa ale nie wiem czy napewno tak powinno być. Gdy naciskam przycisk na pilocie to wykonuje to co jest w kodzie ale czasami zanim zadziała trzeba kilka razy nacisnąć przycisk w pilocie żeby zadziałało a czasem wystarczy raz. I nie wiem czy jest to jakiś problem w kodzie czy może coś z pilotem. Tutaj ten kod:
[syntax=basic4gl][/syntax]$regfile = "m8def.dat"
$crystal = 8000000
Config Portc.1 = Output
Config Portc.0 = Output
Config Portc.4 = Output
Config Portc.5 = Output
Config Portd.2 = Input
Config Portd.4 = Input
Config Portc.2 = Output
Config Rc5 = Pind.2
Enable Interrupts
Prawo Alias Portc.1
Lewo Alias Portc.0
Led1 Alias Portc.4
Led2 Alias Portc.5
Przekaznik Alias Portc.2
Wlacznik Alias Portd.4
Dim Komenda As Byte , Adres As Byte
Do
Getrc5(adres , Komenda)
If Komenda = 2 Then Gosub Jeden
If Komenda = 1 Then Gosub Dwa
If Komenda = 85 Then Gosub Trzy
If Komenda = 86 Then Gosub Cztery
If Komenda = 87 Then Gosub Piec
If Komenda = 127 Then Gosub Szesc
Loop
End
Jeden:
Przekaznik = 0
Led1 = 1
Led2 = 0
Return
Dwa:
Przekaznik = 1
Led1 = 0
Led2 = 1
Return
Trzy:
Lewo = 1
Prawo = 0
Return
Cztery:
Lewo = 0
Prawo = 1
Return
Piec:
Lewo = 0
Prawo = 0
Return
Szesc:
Lewo = 0
Prawo = 0
Return