Tone() unresponsive on Artemis Nano

I am trying to use tone() on a Sparkfun Artemis Nano pin 16. It's the only pin I'm using in my test code.

If I loop this I can change the delay value and get sound output:

digitalWrite(soundOut, HIGH);
delay(3);
digitalWrite(soundOut, LOW);
delay(3);

The following compile without errors but get nothing if I do this:
tone(16, 200);

or
tone(soundOut, 110, 10);

Thoughts?

Thanks!

What kind of buzzer are you using?
Please provide a wiring schematic as well.

I don't think this is your issue but make sure you aren't using tone under 31 hz. I recently ran into an issue where I'd get sporadic values and it turned out that due to limited frequency on the mega processor related to the tone library using millis, any tone under 31 hz gives garbage values, see the tone library documentation section "ugly details". My solution was to just use the constrain() function to prevent values under 31.

Also what is your intended effect with
tone(soundOut, 110, 10);
I didn't think tone took in 3 values. Perhaps we're using different libraries.

While this is true, the sample call provided is at 110Hz, though its only for 1/100th of a second.

Thanks, both.

@er_name_not_found I'm connecting to an amplifier and speaker. When I explicitly toggle the digital output on and off at a given frequency, it works. Why would tone() not work with the same circuit where toggling the pin does?

@buildsomething Yep. Higher than 31 for sure — multiple values 100+ have been tried up to 1000.

I'm working from this page: tone() - Arduino Reference

The tone is short in that snippet, but even when I've put in a delay to repeat it or set longer durations, it hasn't worked. Tone(pin, frequency)—no duration— also doesn't work. That should produce a tone until I call noTone(), but it doesn't.

I'll have a look at the Tone Library. This looks exciting: GitHub - connornishijima/arduino-volume1: Arduino tone() just got 8-bit volume control - with no extra components!. I wanted to get something more basic working, though, before I dove in there.

I'm working from this page: tone() - Arduino Reference

My mistake, I was remembering wrong how the function call worked since I never use the duration.

Are you remembering to initialize the tone before your setup code with
Tone yourTone;

Are you remembering to then begin the tone IN your setup code with
yourTone.begin(PIN)

1 Like

Good points, OP please post all code and a proper diagram of some type.

1 Like

@buildsomething I'm not sure n00b-me understands, but as @er_name_not_found says, it would help if I posted the full code. I don't think this could get any more straight forward so I must have a very fundamental misunderstanding.

This code works:

int soundOut = 16;
void setup() {
  pinMode(soundOut, OUTPUT);
}

void loop() {
    digitalWrite(soundOut, HIGH);
    delay(3);
    digitalWrite(soundOut, LOW);
    delay(3);
  }

This code does not:

int soundOut = 16;
void setup() {
  pinMode(soundOut, OUTPUT);
}

void loop() {
    tone(soundOut, 200);
  }

I started with this example:
Video: Simple Arduino Synthesizer Build - YouTube
Code: SimpleArduinoSynth.ino - Google Drive

That one doesn't have other calls to set up tone() that I see, but perhaps it's done elsewhere and that's the bit I'm missing.

Thanks again for the assistance.

This also makes me think this should work, unless hardware compatibility is my problem: https://itp.nyu.edu/physcomp/labs/labs-arduino-digital-and-analog/tone-output-using-an-arduino/

Specifically:

void setup() {
  // nothing to do here
}
 
void loop() {
  // play the tone for 1 second:
  tone(8, 440,1000);
  // do nothing else for the one second you're playing:
  delay(1000);
}

Playing with it more, it seems I had a serious misunderstanding about how includes/libraries work. I went back to the beginning and think I'm doing that better. Now I'm getting other errors when I compile (below).

Maybe this just isn't compatible? I've also got a thread open on the Artemis forums, where I'll post this.

WARNING: library Tone claims to run on avr architecture(s) and may be incompatible with your current board which runs on apollo3 architecture(s).
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:126:4: error: expected constructor, destructor, or type conversion before '(' token
 ISR(TIMER0_COMPA_vect)
    ^
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:149:4: error: expected constructor, destructor, or type conversion before '(' token
 ISR(TIMER1_COMPA_vect)
    ^
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:171:4: error: expected constructor, destructor, or type conversion before '(' token
 ISR(TIMER2_COMPA_vect)
    ^
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp: In member function 'void Tone::begin(uint8_t)':
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:280:9: error: 'TCCR0A' was not declared in this scope
         TCCR0A = 0;
         ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:281:9: error: 'TCCR0B' was not declared in this scope
         TCCR0B = 0;
         ^~~~~~
In file included from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Interrupts.h:8,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/ArduinoAPI.h:29,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/Arduino.h:17,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/sdk/ArduinoSDK.h:9,
                 from <command-line>:
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:282:26: error: 'WGM01' was not declared in this scope
         bitWrite(TCCR0A, WGM01, 1);
                          ^~~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:49: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                                 ^~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:282:9: note: in expansion of macro 'bitWrite'
         bitWrite(TCCR0A, WGM01, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:283:26: error: 'CS00' was not declared in this scope
         bitWrite(TCCR0B, CS00, 1);
                          ^~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:49: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                                 ^~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:283:9: note: in expansion of macro 'bitWrite'
         bitWrite(TCCR0B, CS00, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:283:26: note: suggested alternative: 'B100'
         bitWrite(TCCR0B, CS00, 1);
                          ^~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:49: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                                 ^~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:283:9: note: in expansion of macro 'bitWrite'
         bitWrite(TCCR0B, CS00, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:284:46: error: 'digitalPinToPort' was not declared in this scope
         timer0_pin_port = portOutputRegister(digitalPinToPort(_pin));
                                              ^~~~~~~~~~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:284:46: note: suggested alternative: 'digitalPinToInterrupt'
         timer0_pin_port = portOutputRegister(digitalPinToPort(_pin));
                                              ^~~~~~~~~~~~~~~~
                                              digitalPinToInterrupt
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:284:27: error: 'portOutputRegister' was not declared in this scope
         timer0_pin_port = portOutputRegister(digitalPinToPort(_pin));
                           ^~~~~~~~~~~~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:285:27: error: 'digitalPinToBitMask' was not declared in this scope
         timer0_pin_mask = digitalPinToBitMask(_pin);
                           ^~~~~~~~~~~~~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:285:27: note: suggested alternative: 'digitalPinToInterrupt'
         timer0_pin_mask = digitalPinToBitMask(_pin);
                           ^~~~~~~~~~~~~~~~~~~
                           digitalPinToInterrupt
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:294:9: error: 'TCCR1A' was not declared in this scope
         TCCR1A = 0;
         ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:295:9: error: 'TCCR1B' was not declared in this scope
         TCCR1B = 0;
         ^~~~~~
In file included from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Interrupts.h:8,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/ArduinoAPI.h:29,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/Arduino.h:17,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/sdk/ArduinoSDK.h:9,
                 from <command-line>:
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:296:26: error: 'WGM12' was not declared in this scope
         bitWrite(TCCR1B, WGM12, 1);
                          ^~~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:49: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                                 ^~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:296:9: note: in expansion of macro 'bitWrite'
         bitWrite(TCCR1B, WGM12, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:297:26: error: 'CS10' was not declared in this scope
         bitWrite(TCCR1B, CS10, 1);
                          ^~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:49: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                                 ^~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:297:9: note: in expansion of macro 'bitWrite'
         bitWrite(TCCR1B, CS10, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:297:26: note: suggested alternative: 'B110'
         bitWrite(TCCR1B, CS10, 1);
                          ^~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:49: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                                 ^~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:297:9: note: in expansion of macro 'bitWrite'
         bitWrite(TCCR1B, CS10, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:306:9: error: 'TCCR2A' was not declared in this scope
         TCCR2A = 0;
         ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:307:9: error: 'TCCR2B' was not declared in this scope
         TCCR2B = 0;
         ^~~~~~
In file included from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Interrupts.h:8,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/ArduinoAPI.h:29,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/Arduino.h:17,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/sdk/ArduinoSDK.h:9,
                 from <command-line>:
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:308:26: error: 'WGM21' was not declared in this scope
         bitWrite(TCCR2A, WGM21, 1);
                          ^~~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:49: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                                 ^~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:308:9: note: in expansion of macro 'bitWrite'
         bitWrite(TCCR2A, WGM21, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:309:26: error: 'CS20' was not declared in this scope
         bitWrite(TCCR2B, CS20, 1);
                          ^~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:49: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                                 ^~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:309:9: note: in expansion of macro 'bitWrite'
         bitWrite(TCCR2B, CS20, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:309:26: note: suggested alternative: '._20'
         bitWrite(TCCR2B, CS20, 1);
                          ^~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:49: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                                 ^~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:309:9: note: in expansion of macro 'bitWrite'
         bitWrite(TCCR2B, CS20, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp: In member function 'void Tone::play(uint16_t, uint32_t)':
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:382:13: error: 'F_CPU' was not declared in this scope
       ocr = F_CPU / frequency / 2 - 1;
             ^~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:382:13: note: suggested alternative: 'FPU'
       ocr = F_CPU / frequency / 2 - 1;
             ^~~~~
             FPU
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:422:9: error: 'TCCR0B' was not declared in this scope
         TCCR0B = (TCCR0B & 0b11111000) | prescalarbits;
         ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:425:9: error: 'TCCR2B' was not declared in this scope
         TCCR2B = (TCCR2B & 0b11111000) | prescalarbits;
         ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:430:13: error: 'F_CPU' was not declared in this scope
       ocr = F_CPU / frequency / 2 - 1;
             ^~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:430:13: note: suggested alternative: 'FPU'
       ocr = F_CPU / frequency / 2 - 1;
             ^~~~~
             FPU
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:440:9: error: 'TCCR1B' was not declared in this scope
         TCCR1B = (TCCR1B & 0b11111000) | prescalarbits;
         ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:471:9: error: 'OCR0A' was not declared in this scope
         OCR0A = ocr;
         ^~~~~
In file included from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Interrupts.h:8,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/ArduinoAPI.h:29,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/Arduino.h:17,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/sdk/ArduinoSDK.h:9,
                 from <command-line>:
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:473:18: error: 'TIMSK0' was not declared in this scope
         bitWrite(TIMSK0, OCIE0A, 1);
                  ^~~~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:30: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                              ^~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:473:9: note: in expansion of macro 'bitWrite'
         bitWrite(TIMSK0, OCIE0A, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:473:26: error: 'OCIE0A' was not declared in this scope
         bitWrite(TIMSK0, OCIE0A, 1);
                          ^~~~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:49: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                                 ^~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:473:9: note: in expansion of macro 'bitWrite'
         bitWrite(TIMSK0, OCIE0A, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:478:9: error: 'OCR1A' was not declared in this scope
         OCR1A = ocr;
         ^~~~~
In file included from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Interrupts.h:8,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/ArduinoAPI.h:29,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/Arduino.h:17,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/sdk/ArduinoSDK.h:9,
                 from <command-line>:
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:480:18: error: 'TIMSK1' was not declared in this scope
         bitWrite(TIMSK1, OCIE1A, 1);
                  ^~~~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:30: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                              ^~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:480:9: note: in expansion of macro 'bitWrite'
         bitWrite(TIMSK1, OCIE1A, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:480:26: error: 'OCIE1A' was not declared in this scope
         bitWrite(TIMSK1, OCIE1A, 1);
                          ^~~~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:49: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                                 ^~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:480:9: note: in expansion of macro 'bitWrite'
         bitWrite(TIMSK1, OCIE1A, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:483:9: error: 'OCR2A' was not declared in this scope
         OCR2A = ocr;
         ^~~~~
In file included from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Interrupts.h:8,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/ArduinoAPI.h:29,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/Arduino.h:17,
                 from /Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/sdk/ArduinoSDK.h:9,
                 from <command-line>:
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:485:18: error: 'TIMSK2' was not declared in this scope
         bitWrite(TIMSK2, OCIE2A, 1);
                  ^~~~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:30: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                              ^~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:485:9: note: in expansion of macro 'bitWrite'
         bitWrite(TIMSK2, OCIE2A, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:485:26: error: 'OCIE2A' was not declared in this scope
         bitWrite(TIMSK2, OCIE2A, 1);
                          ^~~~~~
/Users/mjwarne/Library/Arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-api/api/Common.h:65:49: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))
                                                 ^~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:485:9: note: in expansion of macro 'bitWrite'
         bitWrite(TIMSK2, OCIE2A, 1);
         ^~~~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp: In member function 'void Tone::stop()':
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:517:7: error: 'TIMSK0' was not declared in this scope
       TIMSK0 &= ~(1 << OCIE0A);
       ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:517:24: error: 'OCIE0A' was not declared in this scope
       TIMSK0 &= ~(1 << OCIE0A);
                        ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:521:7: error: 'TIMSK1' was not declared in this scope
       TIMSK1 &= ~(1 << OCIE1A);
       ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:521:24: error: 'OCIE1A' was not declared in this scope
       TIMSK1 &= ~(1 << OCIE1A);
                        ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:524:7: error: 'TIMSK2' was not declared in this scope
       TIMSK2 &= ~(1 << OCIE2A);
       ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:524:24: error: 'OCIE2A' was not declared in this scope
       TIMSK2 &= ~(1 << OCIE2A);
                        ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp: In member function 'bool Tone::isPlaying()':
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:552:22: error: 'TIMSK0' was not declared in this scope
       returnvalue = (TIMSK0 & (1 << OCIE0A));
                      ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:552:37: error: 'OCIE0A' was not declared in this scope
       returnvalue = (TIMSK0 & (1 << OCIE0A));
                                     ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:557:22: error: 'TIMSK1' was not declared in this scope
       returnvalue = (TIMSK1 & (1 << OCIE1A));
                      ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:557:37: error: 'OCIE1A' was not declared in this scope
       returnvalue = (TIMSK1 & (1 << OCIE1A));
                                     ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:560:22: error: 'TIMSK2' was not declared in this scope
       returnvalue = (TIMSK2 & (1 << OCIE2A));
                      ^~~~~~
/Users/mjwarne/Documents/Arduino/libraries/Tone/Tone.cpp:560:37: error: 'OCIE2A' was not declared in this scope
       returnvalue = (TIMSK2 & (1 << OCIE2A));
                                     ^~~~~~

exit status 1

Compilation error: exit status 1

Ah, that's because it's for AVR architecture.
Your Artemis Nano does not have the same ports.

Thanks. I appreciate the help. I may just bite the bullet when get a different board.

ToneLibrary - Arduino Reference

Any board on this page or a compatible clone should do fine. If in doubt, come back to this thread with a product link for verification.

SparkFun provide own core at which point either you are not using provided with it adjusted libraries or SparFun did not adapt all Arduino functions to own product

Thanks, @er_name_not_found and @killzone_kid. There was an error in the library for my board. This fixed it: Using tone() with Artemis Nano - SparkFun Electronics.

best,
Matthew

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.