The BusOut Interface can be used on any pin with a blue label, and also with the on-board LEDs (LED1-LED4)
The BusOut Interface can be used to set the state of the output pin, and also read back the current output state. Set the BusOut to zero to turn it off, or 1 to turn it on.
Thanks, and also I'm trying to debug a program. Do the pins get set in the order that they are declared in the constructor? So setting a BusOut variable like:
BusOut CL(p19, p20, p18, p22);
CL = 2; would make p19 store 2?
CL = 3; would make p20 store 3? And so on?
Thanks, and also I'm trying to debug a program. Do the pins get set in the order that they are declared in the constructor? So setting a BusOut variable like:
BusOut CL(p19, p20, p18, p22);
CL = 2; would make p19 store 2?
CL = 3; would make p20 store 3? And so on?
I just commented on this very documentation deficiency in the Comments for BusIn(), and the documentation for this is even less well-specified, because you can't intuit its behavior even from the example.
Assuming that BusIn and BusOut are orthogonal, one can only assume that the following is the case (assuming active-high LEDs):
CL = 0; all LEDs off
CL = 1; a.k.a. 1<<0 or 0x1, (only) LED0 on
CL = 2; a.k.a. 1<<1 or 0x2, (only) LED1 on
CL = 4; a.k.a. 1<<2 or 0x4, (only) LED2 on
CL = 8; a.k.a. 1<<3 or 0x8, (only) LED3 on
That is, where the leftmost bits are the MSBs (most-significant bits) in the read/written "int" type, the parameters are actually passed in *reverse* order, LSB to MSB, as follows (as packed into bit positions 15..0 in an "int", respectively):
- - - - - - - - - - - - p22 p18 p20 p19
Even though the documentation isn't clear, from your example it seems like you're not "thinking binary" from your statement about p20 perhaps being "3". Each pin is a single *bit*... either a 1 or a 0. If you're not into thinking binary (yet), perhaps the following would help: http://www.arduino.cc/playground/Code/BitMath.
If it's still unclear, I'm guessing that the Forum would probably be a better place to get help.
@Christopher Garner
I just commented on this very documentation deficiency in the Comments for BusIn(), and the documentation for this is even less well-specified, because you can't intuit its behavior even from the example.
Assuming that BusIn and BusOut are orthogonal, one can only assume that the following is the case (assuming active-high LEDs):
CL = 0; // all LEDs off
CL = 1; // a.k.a. 1<<0 or 0x1, (only) LED0 on
CL = 2; // a.k.a. 1<<1 or 0x2, (only) LED1 on
CL = 4; // a.k.a. 1<<2 or 0x4, (only) LED2 on
CL = 8; // a.k.a. 1<<3 or 0x8, (only) LED3 on
That is, where the leftmost bits are the MSBs (most-significant bits) in the read/written "int" type, the parameters are actually passed in *reverse* order, LSB to MSB, as follows (as packed into bit positions 15..0 in an "int", respectively):
- - - - - - - - - - - - p22 p18 p20 p19
Even though the documentation isn't clear, from your example it seems like you're not "thinking binary" from your statement about p20 perhaps being "3". Each pin is a single *bit*... either a 1 or a 0. If you're not into thinking binary (yet), perhaps the following would help: http://www.arduino.cc/playground/Code/BitMath.
If it's still unclear, I'm guessing that the Forum would probably be a better place to get help.
I still don't understand how BusOut works... i have 2 of them:
BusOut lvl(p19, p20);
BusOut col(p21, p22, p23, p24);
what do i have to write in lvl so that p19=1 and p20=0 and most of all what do i have to write in col so that i could have something like: p21=1 p22=0 p23=1 p24=1 (???)
please i really need your help! :D
I still don't understand how BusOut works... i have 2 of them:
BusOut lvl(p19, p20);
BusOut col(p21, p22, p23, p24);
what do i have to write in lvl so that p19=1 and p20=0 and most of all what do i have to write in col so that i could have something like: p21=1 p22=0 p23=1 p24=1 (???)
please i really need your help! :D
what do i have to write in lvl so that p19=1 and p20=0 and most of all what do i have to write in col so that i could have something like: p21=1 p22=0 p23=1 p24=1 (???)
I would have thought that this would do it?
lvl = 0x1;
col = 0xd;
<<quote kartex30>>
what do i have to write in lvl so that p19=1 and p20=0 and most of all what do i have to write in col so that i could have something like: p21=1 p22=0 p23=1 p24=1 (???)
<</quote>>
I would have thought that this would do it?
<<code>>
lvl = 0x1;
col = 0xd;
<</code>>
Please login to post comments.