element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Laser Harp issue please help
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 14 replies
  • Subscribers 418 subscribers
  • Views 1667 views
  • Users 0 members are here
Related

Laser Harp issue please help

e14 Contributor
e14 Contributor over 13 years ago

Good Evening,

 

I was hoping you could help I am attempting to build a laser buzzer type harp with my Arduino I have followed a tutorial I found online however when it came to the programming I am experiencing an issue Error compiling

 

 

C:\Users\Scott\Documents\Arduino\libraries\Tone\Tone.cpp: In member function 'void Tone::begin(uint8_t)':

C:\Users\Scott\Documents\Arduino\libraries\Tone\Tone.cpp:121: error: 'bitWrite' was not declared in this scope

C:\Users\Scott\Documents\Arduino\libraries\Tone\Tone.cpp:123: error: 'digitalPinToPort' was not declared in this scope

C:\Users\Scott\Documents\Arduino\libraries\Tone\Tone.cpp:123: error: 'portOutputRegister' was not declared in this scope

C:\Users\Scott\Documents\Arduino\libraries\Tone\Tone.cpp:124: error: 'digitalPinToBitMask' was not declared in this scope

C:\Users\Scott\Documents\Arduino\libraries\Tone\Tone.cpp: In member function 'void Tone::play(uint16_t, uint32_t)':

C:\Users\Scott\Documents\Arduino\libraries\Tone\Tone.cpp:198: error: 'OUTPUT' was not declared in this scope

C:\Users\Scott\Documents\Arduino\libraries\Tone\Tone.cpp:198: error: 'pinMode' was not declared in this scope

C:\Users\Scott\Documents\Arduino\libraries\Tone\Tone.cpp:294: error: 'bitWrite' was not declared in this scope

C:\Users\Scott\Documents\Arduino\libraries\Tone\Tone.cpp: In member function 'void Tone::stop()':

C:\Users\Scott\Documents\Arduino\libraries\Tone\Tone.cpp:361: error: 'digitalWrite' was not declared in this scope

 

here is the tutorial I have followed: http://www.radioshack.com/graphics/uc/rsk/Support/ProductManuals/Laser_Harp_Online_Instructions.pdf

 

Here is the code:

 

#include <Tone.h>

 

const boolean DEBUG = false;

 

const int CALIBRATION_PIN = A5;

const int SPEAKER_PIN = 8;

const int SENSOR_COUNT = 3;

 

typedef struct

{

  int pin;

  int note;

} sensor_type;

 

sensor_type sensor[SENSOR_COUNT];

 

Tone notePlayer;

 

void setup(void)

{

  if (DEBUG) {

    Serial.begin(9600);

  }

  sensor[0].pin = A0; // analog input 0, etc...

  sensor[0].note = NOTE_G3;

  sensor[1].pin = A1;

  sensor[1].note = NOTE_D4;

  sensor[2].pin = A2;

  sensor[2].note = NOTE_A4;

 

  notePlayer.begin(SPEAKER_PIN);

}

 

void loop(void)

{

  int calibration = analogRead(CALIBRATION_PIN);

  if (DEBUG) {

    Serial.print("cal: ");

    Serial.print(calibration);

  }

  int activeSensor = -1;

  for (int p = 0 ; p < SENSOR_COUNT ; p++) {

    int sensor_value = analogRead(sensor[p].pin);

    if (DEBUG) {

      Serial.print("\tsensor ");

      Serial.print(p);

      Serial.print(": ");

      Serial.print(sensor_value);

    }

    if ( sensor_value < calibration ) {

      activeSensor = p;

      if (DEBUG) Serial.print("!"); // "!" indicates note being played

    }

  }

  if (DEBUG) Serial.println();

  if (activeSensor == -1) {

    notePlayer.stop();

  } else {

    notePlayer.play(sensor[activeSensor].note);

  }

  if (DEBUG) delay(1000);

}

 

I look forward to your reply thanks in advance!

 

Scott

  • Sign in to reply
  • Cancel
Parents
  • billabott
    billabott over 13 years ago

    A quick look suggests that this may be the issue:

    http://playground.arduino.cc/Code/Library#WProgram

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 13 years ago in reply to billabott

    I am sorry I am not great with programming just a beginner. I found there is an issue with the tone folder wiring.h needs to be changed to Arduino.h however still receiving compiling errors.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • e14 Contributor
    e14 Contributor over 13 years ago in reply to billabott

    I am sorry I am not great with programming just a beginner. I found there is an issue with the tone folder wiring.h needs to be changed to Arduino.h however still receiving compiling errors.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube