GPY GPIO Pins
-
I tried the "AND" function and that works fine => more the "OR" function reacts like an "AND" function !??
-
@carl-declercq So you connected the button between P10 and GND? How did you connect the LED? If between P1 and GND, it will lite up with a 1 at P9. If connected between P9 and 3V3, it will lite up with a 0 at P9. Nevertheless, the logical operators of MicroPython work as expected. If your set-up does not work as expected, it is better to check the actual levels at the pins individually.
-
This post is deleted! -
@robert-hh Hi Robert thanks for your reply. I use the expantion board 3.1 => P10 is connected to a button S1 and if I measure the voltage on that pin10 I'll get 3.3V (I suppose there is a pull up resistor connected to it via the expantion board).
If I press the button S1 the voltage drops to 0V and the LED that is connected to P9 lites up, the LED is on the expantion board also, so I didn't soldure it myself, and I can't find a decent sceme from the expantion board).
So I get a fysical "0" at P10 and at first I used the code from the tutorial on the site. link to the documentation
It was confusing because they use "IF P10 is "1" the OUTPUT P9 will be "1" and the fysical input from P10 is "0" !?
Now i can live with that so I start building ....I simular to P10, I placed a 10k pull up resistor for P11 and P12. If I use these pins induvidual it works as expected .... but If I use the "OR" command (P10 OR P11 OR P12 must be "1") it does not work. So I tried the AND command to compair.
The AND function works !? so why does the OR function don't ? If I use the OR function in my code and connect the P10 P11 and P12 Pysicaly like an "AND" so they all must be "1" in stead of one of the Pin's must be "1", the LED lite up.I know it is confusing and explaining without actualy seeing it, ... but thanks for your reply man, I appreciate it.
Thanks !!
-
@carl-declercq Just start with the simple pieces.
At what state does the LED light up. with led.value(1) or led.value(0)?
And what do you want to achieve? Should the LED light up, when any of the inputs is 0 or at another logical combination? -
@robert-hh The LED lights up at led.value(1) => the LED must light up if P10 OR P11 OR P12 OR P17 are at the state "1"
-
@carl-declercq That's strange than. What do you get with button() when the button is pressed()?
-
Yes indeed that is strange .... that is my consern .... (Note that I use the expantion board ! I don't have a scheme to see how the components are connected.
When the button is pressed, if I measure with a multimeter, I get 0V at pin10.
Do you use the expantion board ? -
@carl-declercq I use my own carrier board for the modules, where I definitely know where and what is connected.
-
@robert-hh Hm, nice plan, .... do you use pull up resistors ?
-
@carl-declercq Not by default. If I need them, I add them as appropriate.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login