No it's not right... or only partially...
Firstly you didn't tell us what PIC is involved. If you've chosen a PIC with Analog Comparators or ADC's then they usually live on PortA and they will have preference unless you've disabled them. Play exclusively with PortB ONLY... usually you can't go far wrong there.
Secondly... once you've lit your LED, you are aware it'll never switch OFF?
Bookmarks