I've been working on some software to do REALLY basic composition of music. Here's my code so far:

#include "notes_sharps.h"


void setup(){

  for(int i = 0; i < 51; i++){
    Serial.println("%i's sharp is %i",notes[i], notes[i]+(notes[i]*0.05937));  

void loop(){}

This code just refuses to compile, no error messages, it simply leaves my computer dormant. Here's the log:

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard C:\Users\anidude\AppData\Local\Temp\build38239327143584304.tmp\sharpscalc.cpp -o C:\Users\anidude\AppData\Local\Temp\build38239327143584304.tmp\sharpscalc.cpp.o

  • Are you able to upload other codes to that unit? – Jasmine May 13 '15 at 17:27
  • That's a new usage of Serial.println... I think you're mixing Serial.println(const char *) and sprintf(char *buf, const char *format, ...) – Majenko May 13 '15 at 17:28
  • @Jasmine I can run the example toneMelody without error. – Preston Shumway May 13 '15 at 17:32
  • 1
    I tried it and I got a very clear error message: "fatal error: notes_sharps.h: No such file or directory". If I create the missing file, another error message, just as clear: "error: no matching function for call to ‘HardwareSerial::println(const char [17], int&, double)’". – Edgar Bonet May 13 '15 at 17:39
  • here's the actual notes_sharps.h file pastebin.com/KVahvSNx – Preston Shumway May 13 '15 at 17:43

As Majenko stated in the comments, your use of the println function is not valid as there exists no overload that takes char*, int, int as parameters.

You could get your program to work by replacing your println as following:

for(int i = 0; i < 51; i++){
    Serial.print("'s sharp is ");
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.