I am looking for some recommendations for using the Gpio on the opi PC ( with uname -r 5.7.15-sunxi )
The project is to open and close a glass house door using a temperature probe ( ds18B20 ) and a relay control board ( opto coupled with active low input ).
Later I will add automatic watering relay board.
The pins I would like to use are
Inputs
PC0 used for ds18B20 (SPI0_MOSI) because it is an Input
PC4 Door closed switch Internal pullup
PC7 Door is fully open switch Internal pullup
PC3 Input to be used later(SPI0_CS) Innternal pullup
Outputs
PD14 output MC motor close door
PC1 (SPI0_MISO) output MC motor close door because it is an output
Proposed outputs to be used later
PA0 (UART2_TX/JTAG_MS/PA_EINT0)
PA11 (TWI0_SCK/DI_TX/PA_EINT11)
PA13 (SPI1_CS/UART3_TX/PA_EINT13)
PG6 (UART1_TX/PG_EINT6)
Data from Allwinner H3 Datasheet
I am using these commands to set inputs
echo 71 > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio71/direction
My questions are:
1) what do you think of the chosen pins?
2) Do I need to do anything to configure inputs to use pullups?
3) How can I set output pins to start out as high so as not to trigger the relay on startup?
I am trying to use for outup
echo 110 > /sys/class/gpio/export # pin12 PD14 MCD o/p relay 110
echo "out" > /sys/class/gpio/gpio110/direction
echo 1 > /sys/class/gpio/gpio110/value
which causes the relay to turn ON then OFF
Thanks for all of your advice
Dave