WhiteSpace
Well-known member
I'm still working on the infrared remote control vehicle for which some of you have helped on various aspects. I'm making good progress and the motor controls seem fairly stable now after all sorts of teething troubles. It's all a bit quicker now after moving the current sense reading, voltage reading and display (in fact everything except the IRIN and the motor control) off to a second Picaxe. Now I would like to implement remote control for accessories such as headlights or a winch or whatever. I have some space on top of the motor controls in the IROUT/IRIN controls. The motor controls take up 0-103 of IROUT (it currently transmits left motor PWM and direction controls in the range 0-51 and right motor 52-103), so I still have 25 IROUT commands to play with up to the total 128. I'm thinking of adding a number of on/off switches to the transmitter. Let's say there are 4. If switches 1 and 2 are on, and 0 and 3 off, that gives binary 0110, I think, which I think is decimal 6. If I add that to 104 to transmit a 3rd unique IROUT value, then I can decode it at the receiver chip, convert to binary and that will instruct output pins 1 and 2 on, turning on the headlights and whatever else. I'm a bit stuck as to how to do all of that, though. On the transmitter side, I think I can do let b1 = pinsX , although according to the manual, that's based on 8 pins. Then let b1 = b1 + 104, and then IROUT b1. Then how do I unscramble that at the receiver end? Is it just a case of let b1 = b1 - 104 and let pinsX = b1? Can I mix up binary and decimal numbers like that? All thoughts gratefully received. Thanks very much.