diff --git a/cc3200/mods/pybpin.c b/cc3200/mods/pybpin.c
index 3e69d50cf63ec1bb727f4a22ae37c5719995e500..c1c0350548374b7e01031f5d4779b169b3fb7864 100644
--- a/cc3200/mods/pybpin.c
+++ b/cc3200/mods/pybpin.c
@@ -73,6 +73,7 @@ STATIC void pin_validate_mode (uint mode);
 STATIC void pin_validate_pull (uint pull);
 STATIC void pin_validate_drive (uint strength);
 STATIC void pin_validate_af(const pin_obj_t* pin, int8_t idx, uint8_t *fn, uint8_t *unit, uint8_t *type);
+STATIC uint8_t pin_get_value(const pin_obj_t* self);
 STATIC void GPIOA0IntHandler (void);
 STATIC void GPIOA1IntHandler (void);
 STATIC void GPIOA2IntHandler (void);
@@ -456,6 +457,29 @@ STATIC void pin_validate_af(const pin_obj_t* pin, int8_t idx, uint8_t *fn, uint8
     nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, mpexception_value_invalid_arguments));
 }
 
+STATIC uint8_t pin_get_value (const pin_obj_t* self) {
+    uint32_t value;
+    bool setdir = false;
+    if (self->mode == PIN_TYPE_OD || self->mode == GPIO_DIR_MODE_ALT_OD) {
+        setdir = true;
+        // configure the direction to IN for a moment in order to read the pin value
+        MAP_GPIODirModeSet(self->port, self->bit, GPIO_DIR_MODE_IN);
+    }
+    // now get the value
+    value = MAP_GPIOPinRead(self->port, self->bit);
+    if (setdir) {
+        // set the direction back to output
+        MAP_GPIODirModeSet(self->port, self->bit, GPIO_DIR_MODE_OUT);
+        if (self->value) {
+            MAP_GPIOPinWrite(self->port, self->bit, self->bit);
+        } else {
+            MAP_GPIOPinWrite(self->port, self->bit, 0);
+        }
+    }
+    // return it
+    return value ? 1 : 0;
+}
+
 STATIC void GPIOA0IntHandler (void) {
     EXTI_Handler(GPIOA0_BASE);
 }
@@ -648,8 +672,8 @@ MP_DEFINE_CONST_FUN_OBJ_KW(pin_init_obj, 1, pin_obj_init);
 STATIC mp_obj_t pin_value(mp_uint_t n_args, const mp_obj_t *args) {
     pin_obj_t *self = args[0];
     if (n_args == 1) {
-        // get the pin value
-        return MP_OBJ_NEW_SMALL_INT(MAP_GPIOPinRead(self->port, self->bit) ? 1 : 0);
+        // get the value
+        return MP_OBJ_NEW_SMALL_INT(pin_get_value(self));
     } else {
         // set the pin value
         if (mp_obj_is_true(args[1])) {