Close

The Code

A project log for Truck Radio Circuit

I just found an old hdd, and this is the first useful program I ever wrote.

jlbrian7jlbrian7 06/23/2017 at 00:150 Comments
' {$STAMP BS2}
' {$PBASIC 2.5}

RCT VAR Word
rcreps VAR Byte

PDA PIN 7
RadioSwitch PIN 10

HIGH RadioSwitch
PAUSE 3000
LOW RadioSwitch
rcreps = 0
DO
  INPUT PDA
  RCTIME PDA, 1, RCT
  DEBUG ? RCT
  PAUSE 500
  SELECT RCT
    CASE = 0
      rcreps = rcreps + 1
      IF (PDA = 0) THEN
        rcreps = 0
      ELSE
        IF (rcreps = 3) THEN
          LOW RadioSwitch
          rcreps = 0
        ENDIF
      ENDIF
    CASE = 1
      rcreps = rcreps + 1
      IF (rcreps = 3) THEN
        LOW RadioSwitch
        rcreps = 0
      ENDIF
    CASE ELSE
      HIGH RadioSwitch
      rcreps = 0
      PAUSE 3000
  ENDSELECT

  DEBUG ? PDA
  DEBUG ? RadioSwitch

LOOP

Apparently highlighting isn't available for Basic. Who would have thought.

This code always worked to switch over to the audio output from the PDA, but would randomly cut the radio out when I wasn't using the PDA.

I never bothered to fix the problem, or figure out why. I was so happy that I had done something electrical that worked I said 'Fuck it, it's good!'

Discussions