# Code works on cli but not web IDE

**URL:** <https://community.particle.io/t/code-works-on-cli-but-not-web-ide/13270>\
**Category:** Troubleshooting\
**Created:** [July 14, 2015, 10:37pm UTC](https://community.particle.io/t/code-works-on-cli-but-not-web-ide/13270 "2015-07-14T22:37:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![osmithy](https://avatars.discourse-cdn.com/v4/letter/o/e0b2c6/32.png) [@osmithy](https://community.particle.io/u/osmithy)\
**Post date:** [July 14, 2015, 10:37pm UTC](https://community.particle.io/t/code-works-on-cli-but-not-web-ide/13270/1 "2015-07-14T22:37:48Z")

</div>

My code will compile on the particle-cli but not on the web IDE. The error is that a function was not declared in this scope. The function is “defined” at the top of the file with the macros created to deal with the [PIN\_MAP issue](http://community.particle.io/t/photon-and-the-pin-map-challenge/12223). Any idea why it wouldn’t work in the web IDE? Here’s the code that seems to be affecting this:

```
#if defined(PLATFORM_ID) //Only defined if a Particle device
  #include "application.h"
  STM32_Pin_Info* PIN_MAP = HAL_Pin_Map(); // Pointer required for highest access speed
#if (PLATFORM_ID == 0) // Core
  #define pinLO(_pin) (PIN_MAP[_pin].gpio_peripheral->BRR = PIN_MAP[_pin].gpio_pin)
  #define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin)
#elif (PLATFORM_ID == 6) // Photon
  #define pinLO(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRRH = PIN_MAP[_pin].gpio_pin)
  #define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRRL = PIN_MAP[_pin].gpio_pin)
#else
  #error " ***PLATFORM_ID not supported by this library. PLATFORM should be Core or Photon***"
#endif
#endif

/ ********************************** low level pin interface */

inline void Adafruit_SSD1351::spiwrite(uint8_t c) {
    //Serial.println(c, HEX);
if (!_sid) {
    SPI.transfer(c);
	// might be able to make this even faster but
	// a delay -is- required
	//delayMicroseconds(1);
    return;
}

//Software SPI, MSB first
for (uint8_t bit = 0; bit < 8; bit++) {
pinLO(_sclk); // PIN_MAP[_sclk].gpio_peripheral->BRR = PIN_MAP[_sclk].gpio_pin; // Clock Low

	if (c & (1 << (7-bit))) // walk down mask from bit 7 to bit 0
  pinHI(_sid); // PIN_MAP[_sid].gpio_peripheral->BSRR = PIN_MAP[_sid].gpio_pin; // Data High
	else
  pinLO(_sid); // PIN_MAP[_sid].gpio_peripheral->BRR = PIN_MAP[_sid].gpio_pin; // Data Low

pinHI(_sclk); // PIN_MAP[_sclk].gpio_peripheral->BSRR = PIN_MAP[_sclk].gpio_pin; // Clock High
}

}

```

The errors are that pinLO and pinHI are not declared in this scope. But it works fine in the cli. Any ideas??

---

<div class="post-metadata">

**Author:** ![corey](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/corey/32/5703_2.png) [@corey](https://community.particle.io/u/corey)\
**Post date:** [July 14, 2015, 11:10pm UTC](https://community.particle.io/t/code-works-on-cli-but-not-web-ide/13270/2 "2015-07-14T23:10:02Z")

</div>

Hey @osmithy are you sure you defined your variables correctly at the top? I know you’re trying to re-use the example related to the PIN\_MAP issue, but let’s make sure the the variables are correctly defined.

I’m also saying this to be taken with a “grain of salt” since I cannot see the entire program nor can I see the header in its completeness.

I’ll look further into this issue! 😄

Be Back Soon Enough,  
Corey

---

<div class="post-metadata">

**Author:** ![osmithy](https://avatars.discourse-cdn.com/v4/letter/o/e0b2c6/32.png) [@osmithy](https://community.particle.io/u/osmithy)\
**Post date:** [July 14, 2015, 11:58pm UTC](https://community.particle.io/t/code-works-on-cli-but-not-web-ide/13270/3 "2015-07-14T23:58:17Z")

</div>

Hi Corey! If you can access my un-published library, it’s at [https://build.particle.io/libs/559d853ada4c3c23a70007ca](https://build.particle.io/libs/559d853ada4c3c23a70007ca) and the example is test.ino.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [July 15, 2015, 7:51am UTC](https://community.particle.io/t/code-works-on-cli-but-not-web-ide/13270/4 "2015-07-15T07:51:08Z")

</div>

Are you building against a Core or Photon?  
If you’re building against a Core, try this

```auto
#if defined(SPARK)
  #include "application.h"

  #if defined(PLATFORM_ID) // Only defined for Particle device with HAL FW
    STM32_Pin_Info* PIN_MAP = HAL_Pin_Map(); // ptr required
  #endif

  #if !defined(PLATFORM_ID) || (PLATFORM_ID == 0) // Core
    #define pinLO(_pin) (PIN_MAP[_pin].gpio_peripheral->BRR = PIN_MAP[_pin].gpio_pin)
    #define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin)
  #elif (PLATFORM_ID == 6) // Photon
    #define pinLO(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRRH = PIN_MAP[_pin].gpio_pin)
    #define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRRL = PIN_MAP[_pin].gpio_pin)
  #else
    #error " ***PLATFORM_ID not supported by this library. PLATFORM should be Core or Photon***"
  #endif
#endif

```

I’m not sure that `PLATFORM_ID` is already defined for Core FW v0.3.4
