[solved] digitalPinToPort on Blend v2


#1

Hello,

I just started playing around with my Blend 2 and ran into some issues with my Grove Circular LED. Using the sample given:

http://wiki.seeed.cc/Grove-Circular_LED/

I quickly run into compiling issues:

CircularLED.cpp:37: error: ‘digitalPinToPort’ was not declared in this scope
PORT_Data = portOutputRegister(digitalPinToPort(_data));
CircularLED.cpp:37: error: ‘portOutputRegister’ was not declared in this scope
PORT_Data = portOutputRegister(digitalPinToPort(_data));

I’m not sure what causes this. Arduino.h is included in the top of the file. Digging around a bit I found this:

“I had the same problem as these commands do not convert properly to ARM low level port instructions. The proper way is to use the ARM equivalents, but I do not know what they are yet.”

I guess this might be the issue, but not sure where to go from here.

Any assistance is appreciated.


#2

I managed to solve this, and I’ll leave my solution to another noob like me who might stumble into the same issue :slight_smile: Turns out the library provided was overly complicated. It could simply be solved by using digitalWrite. I’m not sure if these methods aren’t as performant as the originals, but it works for this little project at least.

I’ve written a library but not yet published, so if you’re completely lost you’re welcome to contact me to get a copy. It’s probably incredibly simple for someone who have done this for years, but as this is my first ever component to work with I must admit i hit a brick wall :smiley: