extern "C" int digitalRead(uint8_t pin) { ResourceMap *rmap = ResourceMap::getInstance(); Pin *p = rmap->getPin(pin); if (!p) return -1; if (p->getValue()) return HIGH; return LOW; }