File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 101101_SET_DIGITAL_WRITE_CMD = const (0x51 )
102102_SET_ANALOG_WRITE_CMD = const (0x52 )
103103_SET_DIGITAL_READ_CMD = const (0x53 )
104+ _SET_ANALOG_READ_CMD = const (0x54 )
104105
105106_START_CMD = const (0xE0 )
106107_END_CMD = const (0xEE )
@@ -790,6 +791,19 @@ def set_digital_read(self, pin):
790791 ((pin ,),))[0 ]
791792 return resp [0 ]
792793
794+ def set_analog_read (self , pin ):
795+ """
796+ Get the analog input value of pin.
797+
798+ :param int pin: ESP32 GPIO pin to read from.
799+ """
800+ resp = self ._send_command_get_response (_SET_ANALOG_READ_CMD ,
801+ ((pin ,),))[0 ]
802+ resp_a = struct .unpack ('<i' , resp [0 ])
803+ if resp_a == (- 1 ,):
804+ raise ValueError ("_SET_ANALOG_READ parameter error -1" )
805+ return resp_time
806+
793807 def get_time (self ):
794808 """The current unix timestamp"""
795809 if self .status == WL_CONNECTED :
You can’t perform that action at this time.
0 commit comments