# Artemis and RadioHead library

**URL:** <https://community.sparkfun.com/t/artemis-and-radiohead-library/43348>\
**Category:** Artemis\
**Created:** [January 17, 2022, 3:07pm UTC](https://community.sparkfun.com/t/artemis-and-radiohead-library/43348 "2022-01-17T15:07:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![edringel](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@edringel](https://community.sparkfun.com/u/edringel)\
**Post date:** [January 17, 2022, 3:07pm UTC](https://community.sparkfun.com/t/artemis-and-radiohead-library/43348/1 "2022-01-17T15:07:31Z")

</div>

Hi all,

trying to use the RadioHead library with an Artemis board, using Arduino. The low power aspect of the board is great, because I’m going to use the device as a remote outdoor weather station. I’m using a HopeRF95 LoRa board. I am able to get communication going with RadioLib, but not RadioHead.

I seem to be getting into trouble with the mBed core. I already had to alter my code because mbed doesn’t support a float into a String. That’s ok, there’s an easy workaround (I multiplied the float results from the sensor so I was working with an integer.) However. it looks like the SPI functions are different-- below is just a snippet of a couple of pages of error messages at compile time. Suggestions (other than using a different library) would be welcome. RadioHead is preferable for me because I want to be able to communicate directly and exclusively with individual modules and addressing an individual node looks easier. Error msg below. Thank you in advance. //Ed

Arduino: 1.8.13 (Windows 10), TD: 1.53, Board: “Artemis Thing Plus, 460800, SparkFun Variable Loader (Recommended)”

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp: In member function ‘virtual void RHHardwareSPI::begin()’:

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:79:9: error: ‘class arduino::MbedSPI’ has no member named ‘setDataMode’

SPI.setDataMode(dataMode);

^ ~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:92:9: error: ‘class arduino::MbedSPI’ has no member named ‘setBitOrder’

SPI.setBitOrder(bitOrder);

---

<div class="post-metadata">

**Author:** ![TS-Russell](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/ts-russell/32/6092_2.png) [@TS-Russell](https://community.sparkfun.com/u/TS-Russell)\
**Post date:** [January 21, 2022, 5:45pm UTC](https://community.sparkfun.com/t/artemis-and-radiohead-library/43348/2 "2022-01-21T17:45:47Z")

</div>

It looks like that is an incompatibility between that library and mBed OS…try updating the board efinitions via arduino IDE [https://github.com/nRF24/RF24/issues/537](https://github.com/nRF24/RF24/issues/537) and re-try?

---

<div class="post-metadata">

**Author:** ![paulvha](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@paulvha](https://community.sparkfun.com/u/paulvha)\
**Post date:** [January 21, 2022, 7:53pm UTC](https://community.sparkfun.com/t/artemis-and-radiohead-library/43348/3 "2022-01-21T19:53:30Z")

</div>

Install library version 1.2.3 and these calls are still accepted in this library version. The biggest aspect you lose in a default configuration is BLE.

---

<div class="post-metadata">

**Author:** ![edringel](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@edringel](https://community.sparkfun.com/u/edringel)\
**Post date:** [January 30, 2022, 2:15pm UTC](https://community.sparkfun.com/t/artemis-and-radiohead-library/43348/4 "2022-01-30T14:15:05Z")

</div>

thank you both for your input. Regrettably, neither suggestion worked. I’ll use a brute force hack with radioLib.

---

<div class="post-metadata">

**Author:** ![paulvha](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@paulvha](https://community.sparkfun.com/u/paulvha)\
**Post date:** [January 30, 2022, 2:57pm UTC](https://community.sparkfun.com/t/artemis-and-radiohead-library/43348/5 "2022-01-30T14:57:05Z")

</div>

out of interest: what did not work ? Was the setBitOrder call not found ?

---

<div class="post-metadata">

**Author:** ![edringel](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@edringel](https://community.sparkfun.com/u/edringel)\
**Post date:** [February 3, 2022, 1:13pm UTC](https://community.sparkfun.com/t/artemis-and-radiohead-library/43348/6 "2022-02-03T13:13:53Z")

</div>

Thanks for the replies–

sipan1313-- thanks for the general info. I was aware of the need for two objects for the code to work. I usually run an example before I start coding my own project. The compiler failed to compile an example sketch; I don’t remember exactly which one.

paulvha-- error dump below. The compiler was exceedingly unhappy… I’m a decent intermediate grade programmer but not the most savvy by any means. I depend on libraries a lot so I don’t understand all of the subtleties. However, after doing some research and reading, looks like the problem is with the mBed core not supporting all the SPI functions. I would not know how to alter the code to make this work.

FWIW, I ended up using the LoRa library by Sandeep Mistry. Easy to use and seems to be reliable. I had to add some simple extra message filtering code to allow addressing a single unit out of three deployed, but that was a lot easier than messing with the hardware interface. Appreciate your interest.

Arduino: 1.8.13 (Windows 10), TD: 1.53, Board: “Artemis Thing Plus, 460800, SparkFun Variable Loader (Recommended)”

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp: In member function ‘virtual void RHHardwareSPI::begin()’:

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:79:9: error: ‘class arduino::MbedSPI’ has no member named ‘setDataMode’

SPI.setDataMode(dataMode);

^ ~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:92:9: error: ‘class arduino::MbedSPI’ has no member named ‘setBitOrder’

SPI.setBitOrder(bitOrder);

^ ~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:28:27: error: ‘VARIANT\_MCK’ was not declared in this scope

#define SPI\_CLOCK\_DIV16 (VARIANT\_MCK/84000000) // 1MHz

^ ~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:102:16: note: in expansion of macro ‘SPI\_CLOCK\_DIV16’

divider = SPI\_CLOCK\_DIV16;

^ ~~~~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:28:27: note: suggested alternative: ‘VARIANT\_SPI\_CLK’

#define SPI\_CLOCK\_DIV16 (VARIANT\_MCK/84000000) // 1MHz

^ ~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:102:16: note: in expansion of macro ‘SPI\_CLOCK\_DIV16’

divider = SPI\_CLOCK\_DIV16;

^ ~~~~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp:131:9: error: ‘class arduino::MbedSPI’ has no member named ‘setClockDivider’

SPI.setClockDivider(divider);

^ ~~~~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp: In member function ‘uint8\_t RH\_ASK::timerCalc(uint16\_t, uint16\_t, uint16\_t\*)’:

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:118:40: error: ‘F\_CPU’ was not declared in this scope

unsigned long inv\_clock\_time = F\_CPU / ((unsigned long)prescalerValue);

^ ~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:118:40: note: suggested alternative: ‘FPU’

unsigned long inv\_clock\_time = F\_CPU / ((unsigned long)prescalerValue);

^ ~~~~

FPU

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp: In member function ‘void RH\_ASK::timerSetup()’:

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:209:5: error: ‘pmc\_set\_writeprotect’ was not declared in this scope

pmc\_set\_writeprotect(false);

^ ~~~~~~~~~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:208:34: error: ‘TC1\_IRQn’ was not declared in this scope

#define RH\_ASK\_DUE\_TIMER\_IRQ TC1\_IRQn

^ ~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:210:27: note: in expansion of macro ‘RH\_ASK\_DUE\_TIMER\_IRQ’

pmc\_enable\_periph\_clk(RH\_ASK\_DUE\_TIMER\_IRQ);

^ ~~~~~~~~~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:208:34: note: suggested alternative: ‘RTC\_IRQn’

#define RH\_ASK\_DUE\_TIMER\_IRQ TC1\_IRQn

^ ~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:210:27: note: in expansion of macro ‘RH\_ASK\_DUE\_TIMER\_IRQ’

pmc\_enable\_periph\_clk(RH\_ASK\_DUE\_TIMER\_IRQ);

^ ~~~~~~~~~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:210:5: error: ‘pmc\_enable\_periph\_clk’ was not declared in this scope

pmc\_enable\_periph\_clk(RH\_ASK\_DUE\_TIMER\_IRQ);

^ ~~~~~~~~~~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:214:20: error: ‘VARIANT\_MCK’ was not declared in this scope

uint32\_t rc = (VARIANT\_MCK / \_speed) / 128 / 8;

^ ~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:214:20: note: suggested alternative: ‘VARIANT\_SPI\_CLK’

uint32\_t rc = (VARIANT\_MCK / \_speed) / 128 / 8;

^ ~~~~~~~~~~

VARIANT\_SPI\_CLK

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:206:30: error: ‘TC0’ was not declared in this scope

#define RH\_ASK\_DUE\_TIMER TC0

^~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:215:18: note: in expansion of macro ‘RH\_ASK\_DUE\_TIMER’

TC\_Configure(RH\_ASK\_DUE\_TIMER, RH\_ASK\_DUE\_TIMER\_CHANNEL,

^ ~~~~~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:216:4: error: ‘TC\_CMR\_WAVE’ was not declared in this scope

TC\_CMR\_WAVE | TC\_CMR\_WAVSEL\_UP\_RC | TC\_CMR\_TCCLKS\_TIMER\_CLOCK4);

^ ~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:216:18: error: ‘TC\_CMR\_WAVSEL\_UP\_RC’ was not declared in this scope

TC\_CMR\_WAVE | TC\_CMR\_WAVSEL\_UP\_RC | TC\_CMR\_TCCLKS\_TIMER\_CLOCK4);

^ ~~~~~~~~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:216:40: error: ‘TC\_CMR\_TCCLKS\_TIMER\_CLOCK4’ was not declared in this scope

TC\_CMR\_WAVE | TC\_CMR\_WAVSEL\_UP\_RC | TC\_CMR\_TCCLKS\_TIMER\_CLOCK4);

^ ~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:215:5: error: ‘TC\_Configure’ was not declared in this scope

TC\_Configure(RH\_ASK\_DUE\_TIMER, RH\_ASK\_DUE\_TIMER\_CHANNEL,

^ ~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:217:5: error: ‘TC\_SetRC’ was not declared in this scope

TC\_SetRC(RH\_ASK\_DUE\_TIMER, RH\_ASK\_DUE\_TIMER\_CHANNEL, rc);

^ ~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:219:69: error: ‘TC\_IER\_CPCS’ was not declared in this scope

RH\_ASK\_DUE\_TIMER-\>TC\_CHANNEL[RH\_ASK\_DUE\_TIMER\_CHANNEL].TC\_IER = TC\_IER\_CPCS;

^ ~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:222:5: error: ‘TC\_Start’ was not declared in this scope

TC\_Start(RH\_ASK\_DUE\_TIMER, RH\_ASK\_DUE\_TIMER\_CHANNEL);

^ ~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:222:5: note: suggested alternative: ‘va\_start’

TC\_Start(RH\_ASK\_DUE\_TIMER, RH\_ASK\_DUE\_TIMER\_CHANNEL);

^ ~~~~~~~

va\_start

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp: In function ‘void TC1\_Handler()’:

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:498:18: error: ‘TC0’ was not declared in this scope

TC\_GetStatus(TC0, 1);

^~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:498:5: error: ‘TC\_GetStatus’ was not declared in this scope

TC\_GetStatus(TC0, 1);

^ ~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_ASK.cpp:498:5: note: suggested alternative: ‘SocketStats’

TC\_GetStatus(TC0, 1);

^ ~~~~~~~~~~~

SocketStats

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_RF22.cpp: In member function ‘virtual bool RH\_RF22::init()’:

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_RF22.cpp:80:28: error: ‘NOT\_AN\_INTERRUPT’ was not declared in this scope

if (interruptNumber == NOT\_AN\_INTERRUPT)

^ ~~~~~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_RF22.cpp:80:28: note: suggested alternative: ‘AM\_HAL\_INTERRUPT\_H’

if (interruptNumber == NOT\_AN\_INTERRUPT)

^ ~~~~~~~~~~~~~~~

AM\_HAL\_INTERRUPT\_H

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_RF69.cpp: In member function ‘virtual bool RH\_RF69::init()’:

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_RF69.cpp:91:28: error: ‘NOT\_AN\_INTERRUPT’ was not declared in this scope

if (interruptNumber == NOT\_AN\_INTERRUPT)

^ ~~~~~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_RF69.cpp:91:28: note: suggested alternative: ‘AM\_HAL\_INTERRUPT\_H’

if (interruptNumber == NOT\_AN\_INTERRUPT)

^ ~~~~~~~~~~~~~~~

AM\_HAL\_INTERRUPT\_H

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_RF95.cpp: In member function ‘virtual bool RH\_RF95::init()’:

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_RF95.cpp:41:28: error: ‘NOT\_AN\_INTERRUPT’ was not declared in this scope

if (interruptNumber == NOT\_AN\_INTERRUPT)

^ ~~~~~~~~~~~~~~~

C:\Users\Ed\_\_XXX\Documents\Arduino\libraries\RadioHead\RH\_RF95.cpp:41:28: note: suggested alternative: ‘AM\_HAL\_INTERRUPT\_H’

if (interruptNumber == NOT\_AN\_INTERRUPT)

^ ~~~~~~~~~~~~~~~

AM\_HAL\_INTERRUPT\_H

exit status 1

Error compiling for board Artemis Thing Plus.

This report would have more information with

“Show verbose output during compilation”

option enabled in File → Preferences.

---

<div class="post-metadata">

**Author:** ![paulvha](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@paulvha](https://community.sparkfun.com/u/paulvha)\
**Post date:** [February 3, 2022, 1:25pm UTC](https://community.sparkfun.com/t/artemis-and-radiohead-library/43348/7 "2022-02-03T13:25:09Z")

</div>

where can I find the library you use online? Maybe I can some changes to make it work

---

<div class="post-metadata">

**Author:** ![edringel](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@edringel](https://community.sparkfun.com/u/edringel)\
**Post date:** [February 3, 2022, 4:03pm UTC](https://community.sparkfun.com/t/artemis-and-radiohead-library/43348/8 "2022-02-03T16:03:41Z")

</div>

Here’s the URL. [http://airspayce.com/mikem/arduino/RadioHead/](http://airspayce.com/mikem/arduino/RadioHead/)

Thank you for your offer to correct the code. If you want to pursue that for your own interest, that would fine, but it’s not a must have at this point.

My new approach is working well, and I don’t **need** to go back to this library.

The RadioHead library is quite robust. If it worked for the Artemis community that would be a plus.

Best regards,

Ed

---

<div class="post-metadata">

**Author:** ![paulvha](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@paulvha](https://community.sparkfun.com/u/paulvha)\
**Post date:** [February 4, 2022, 3:20pm UTC](https://community.sparkfun.com/t/artemis-and-radiohead-library/43348/9 "2022-02-04T15:20:40Z")

</div>

I have made 2 changes to get this to work, It now compiles without errors.

One disadvantage RH-ASK is not supported, but I expect a low impact for most users :

**RH\_ASK Works with a range of inexpensive ASK (amplitude shift keying) RF transceivers such as RX-B1 (also known as ST-RX04-ASK) receiver; TX-C1 transmitter and DR3100 transceiver; FS1000A/XY-MK-5V transceiver; HopeRF RFM83C / RFM85. Supports ASK (OOK).**

[RadioHead\_artemis.zip](https://community.sparkfun.com/uploads/short-url/de84MIp6rw7aQsmH9XT12HVJDmv.zip) (560 KB)

---

<div class="post-metadata">

**Author:** ![edringel](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@edringel](https://community.sparkfun.com/u/edringel)\
**Post date:** [February 13, 2022, 2:42am UTC](https://community.sparkfun.com/t/artemis-and-radiohead-library/43348/10 "2022-02-13T02:42:41Z")

</div>

wow, thank you. I had not been back to this forum for several days. I’m sure this will be useful for me and others. Can’t wait to see this compile.

Ed
