The Pycom board you are using (e.g. WiPy 2.0, LoPy).
The firmware version you are using. You can get it by executing the following Python code at the REPL:
(sysname='GPy', nodename='GPy', release='1.20.2.r2', version='v1.11-3a7776d on 2020-11-23', machine='GPy with ESP32', pybytes='1.6.1')
Hi, I tried to use the GPIO pins on the GPY but I failed. I want to create 4 inputs one of the 4 inputs must be "1" before the output is set. => input 1 OR input 2 OR .... etc.
This is my code:
from machine import Pin import time led = Pin('P9', mode = Pin.OUT) button = Pin('P10', mode = Pin.IN) check1 = Pin('P11', mode = Pin.IN) check2 = Pin('P12', mode = Pin.IN) check3 = Pin('P17', mode = Pin.IN) while True: if(button() == 1 or check1() == 1 or check2() == 1 or check3() == 1): led.value(1) else: led.value(0)
only the "button pin works" => the led on the expantion board lights up if the button is pressed. I use the expantion board 3.1 and I use a pull up resistor for the pin11 and pin12 for pin17 it is not necessary according the datasheet. => It's like the "OR" function does not exists because if I use "AND" it works fine, and if I use "OR" It reacts like a "AND"
Bug report:
(sysname='GPy', nodename='GPy', release='1.20.2.r2', version='v1.11-3a7776d on 2020-11-23', machine='GPy with ESP32', pybytes='1.6.1')
Hi, I tried to use the GPIO pins on the GPY but I failed. I want to create 4 inputs one of the 4 inputs must be "1" before the output is set. => input 1 OR input 2 OR .... etc.
This is my code:
from machine import Pin import time led = Pin('P9', mode = Pin.OUT) button = Pin('P10', mode = Pin.IN) check1 = Pin('P11', mode = Pin.IN) check2 = Pin('P12', mode = Pin.IN) check3 = Pin('P17', mode = Pin.IN) while True: if(button() == 1 or check1() == 1 or check2() == 1 or check3() == 1): led.value(1) else: led.value(0)
only the "button pin works" => the led on the expantion board lights up if the button is pressed. I use the expantion board 3.1 and I use a pull up resistor for the pin11 and pin12 for pin17 it is not necessary according the datasheet. => It's like the "OR" function does not exists because if I use "AND" it works fine, and if I use "OR" It reacts like a "AND"