Dip Switch Address Chart4/23/2021
My problem is that I want to be able to switch addresses as I create more sensors within my array.I plan on using the DIP Switch 8 position I bought from Sparkfun to do the job.However, I do not seem to know how to wire it, or read from it, that is how confused I am.
I have of course tried dozens of approaches, I am currently attaching ground to the on position and digital pin 8 as the off, I have also tried inverting them. What happens is that when i switch to on i get 0 as the value when printed as DEC, when i flip it to off i get 1, and im some instances random noise. Dip Switch Address Chart Code Each PossibilityI understood that I would be able to get up to 255 possible positions, but without being able to get the proper byte data I would have to manually code each possibility, which seems wrong. Also, why is the on functioning as off whether or not I invert the connections. Does anybody have any experience with using DIP Switches to control addresses on the arduino, a schematic and brief explanation would go a long way. Quote Also, why is the on functioning as off whether or not I invert the connections. I want to get the most possible addresses out of 4 switches (i do not have enough room to use all. I created 3 situations: A zero Each switch is a face value and multiplied by one another (off 1) fake a 5th switch (switch 1 5 the others are face values multilpied together). I am currently getting 15 possible addresses from 4 switches. I am currently getting 15 possible addresses from 4 switches 2 4 16. I could not figure out how to get the binary version to work. Binary - Address 0000 - 144 0001 - 145 0010 - 146 0011 - 147 0100 - 148 0101 - 149 0110 - 150 0111 - 151 1000 - 152 1001 - 153 1010 - 154 1011 - 155 1100 - 156 1101 - 157 1110 - 158 1111 - 159. If that doesnt work try:- j j 0x0F; just before the return. I have been working on another element of the project and just got back to this.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |