Deadman Switch

Metawear: RPro
Android SDK: 2.4.0
Firmware: 1.1.3

I am using GPIO1 as a switch to power an external device.  The idea is to have GPIO1 to HIGH while I poll for the data from GPIO0.  GPIO1 would remain HIGH the entire time while polling the RPro from its sensors and GPIO0.  When I am done with the polling then I would need to set GPIO1 to LOW to prevent the external device from draining the battery.

Is there a way that I can have a timer or watchdog on the RPro itself that will set GPIO1 to LOW should the Bluetooth connection be severed? or even to reset the RPro?  I've looked at onSignalActive but this code is running on the phone.

Comments

  • Well that was easier than I thought...

    val settingsModule = metaWearBoard.getModule(classOf[Settings])
    settingsModule
      .handleEvent()
      .fromDisconnect()
      .monitor(new ActivityHandler {
        override def onSignalActive(map: util.Map[String, DataProcessor], dataToken: DataToken): Unit = {
          gpioModule.clearDigitalOut(1)
        }
      })
      .commit()

This discussion has been closed.