'after you've got everything else set up
led1toggle = $56 : led2toggle = $59 : led3toggle = $5a : led4toggle = $65
ledson = $66 : ledsoff = $69
ledswing = $6a
START:
gosub trainreceiver : serout portb.2, n2400, [ ledsoff ] : pause 1000
gosub trainreceiver : serout portb.2, n2400, [ ledson ] : pause 1000
goto start
trainreceiver:
serout portb.2, n2400, [ $aa, $aa, $aa, $aa, $aa ] : return
end
See that? Every time you send a command you have to train the receiver because there is more than about 5ms between commands. If you were to continuously send commands or data, you probably wouldn't need to train the receiver. But in any case, you MUST use manchester encoding! You'll get garbage at the output if you don't!
As this code is setup, all your LEDs should come on for a second, turn off for a second, come on for a second, etc.etc...
Let me know what happens...
JDG
Ok, I just saw the post about using the pot. So use the pot to turn the LEDs on and off. Then after that works, use the POT to turn the LEDs on in sequence to match the pot's rotation.
gosub trainreceiver : serout portb.2, n2400, [ ledsoff ]
if b0 < 64 then gosub trainreceiver : serout portb.2, n2400, [ led1toggle ]
if ( b0 > 63 ) and ( b0 < 128 ) then gosub trainreceiver : serout portb.2, n2400, [ led2toggle ]
if ( b0 > 127 ) and ( b0 < 192 ) then gosub trainreceiver : serout portb.2, n2400, [ led3toggle ]
if ( b0 > 191 ) then gosub trainreceiver : serout portb.2, n2400, [ led4toggle ]




Bookmarks