Hello po,
I need help po sana sa pag write ng code ng python. I am not well versed sa python and I've tried searching the net for what I need, sadly wala ako makitang proper solution.
So here's what I want to do:
Assuming na meron akong 4 button latching inputs.
Okay na ako sa part na babasahin ko yung state nung bawat input kung naka turn on or off sila. (IN1, IN2, IN3, IN4)
Ngayon, kailangan ko gawin is somehow basahin yung apat na yun as one as binary,
so for example: IN1 = 0, IN2 = 0, IN3 = 1, IN4 = 0, so ang kakalabasan niya as binary is 0100 following LSB first(correct me if i'm wrong), then icoconvert ko siya to decimal then iiistore sa isang variable.
so sa case nung sample yung 0100 magiging 4, then ilalagay ko sa variable na let's say bintodec. kaya ang kakalabasan ay bintodec = 4.
yan po.
I need help po sana sa pag write ng code ng python. I am not well versed sa python and I've tried searching the net for what I need, sadly wala ako makitang proper solution.
So here's what I want to do:
Assuming na meron akong 4 button latching inputs.
Okay na ako sa part na babasahin ko yung state nung bawat input kung naka turn on or off sila. (IN1, IN2, IN3, IN4)
Ngayon, kailangan ko gawin is somehow basahin yung apat na yun as one as binary,
so for example: IN1 = 0, IN2 = 0, IN3 = 1, IN4 = 0, so ang kakalabasan niya as binary is 0100 following LSB first(correct me if i'm wrong), then icoconvert ko siya to decimal then iiistore sa isang variable.
so sa case nung sample yung 0100 magiging 4, then ilalagay ko sa variable na let's say bintodec. kaya ang kakalabasan ay bintodec = 4.
yan po.