File tree 1 file changed +14
-0
lines changed 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 101
101
_SET_DIGITAL_WRITE_CMD = const (0x51 )
102
102
_SET_ANALOG_WRITE_CMD = const (0x52 )
103
103
_SET_DIGITAL_READ_CMD = const (0x53 )
104
+ _SET_ANALOG_READ_CMD = const (0x54 )
104
105
105
106
_START_CMD = const (0xE0 )
106
107
_END_CMD = const (0xEE )
@@ -790,6 +791,19 @@ def set_digital_read(self, pin):
790
791
((pin ,),))[0 ]
791
792
return resp [0 ]
792
793
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
+
793
807
def get_time (self ):
794
808
"""The current unix timestamp"""
795
809
if self .status == WL_CONNECTED :
You can’t perform that action at this time.
0 commit comments