Arduino Analog Read and Tones

Class Recap:

  • Introduction to Arduino
  • Circuits, Symbols and Breadboarding

At the end of class we learned about analog inputs, and how they can be mapped to tone values. Digital inputs work in a similar way, instead of reading various values you will only read 1s and 0s, 5 volts or 0 volts. Arduino programming is very similar to Processing, you can add if statements and for loops; utilize the logic you have learned so far. By adding a conditional statement that listens to the button presses, you can trigger a sound. It could be a piece of music you compose or maybe you can make a piano if you make every button have its own sound.


Create a project that uses the tones function, with your piezo buzzer, you can add either an analog or digital input to trigger the sound. In this prototype you should experiment in making an enclosure. This interface should be conceptual and also interactive, think outside the box, or inside the music box, or an instrument, or a toy 🙂

Analog Read:


Analog Read:


/*Class Code: This sketch listens to light! Depending on the variable resistance of your photoresistor you can map its value to tones*/

int speaker = 11;
int sensor = A0;
int sensorValue = 0;

void setup() {
pinMode(sensor, INPUT);
pinMode(speaker, OUTPUT);

void loop() {
sensorValue= analogRead(sensor);
sensorValue = map(sensorValue, 1, 15, 31, 3000);
tone(speaker, sensorValue);

Digital Read:



Digital Read:



This entry was posted in Assignment, Resources on by .

About aisencc

Hello! I'm Aisen Caro Chacin, my curiosity led me to research the intersecting fields of art, science, and technology driven by conceptual forms of inquiry and design thinking resulting in functional prototypes. I'm looking forward to seeing your ideas materialize. My inbox is always open.. so say "Hello!".

161 thoughts on “Arduino Analog Read and Tones

  1. Ann

    When someone wrtites an article he/she maintains
    the image oof a user in his/her brain that
    how a user can understand it. So that’s wwhy his article is
    amazing. Thanks!

    Also visit my website; chinese take away (Ann)

  2. Jacob

    Thanks iin support of sharing such a fastidious thought, article
    is pleasant, thats wwhy i have read it completely

    Also visit my page title loans – Jacob

  3. Hayden

    I think the admin of this wweb page is truly working hard in support of
    his site, as here every stuff is quality based data.

    Visit my wweb blog :: title loans (Hayden)

  4. Refugia

    Woah! I’m really enjoying the template/theme of thiis site.
    It’s simple, yet effective. A lot of times
    it’s very difficult to get that “perfect balance” between usability and appearance.
    I must say you have done a fantastic job with this.
    Additionally,the blog loads extremely quick for
    me on Firefox. Exceptional Blog!

    Also visit my website title loans [Refugia]

  5. Hermelinda

    I just could not leave your site prior too suggesting that I really enjkoyed the standsrd information a persdon supply foor your visitors?
    Is goong to be again regularly inn ordeer to inspect new posts

    Check out my web blog :: title loans [Hermelinda]

  6. Mitchel

    Hey There. I discovered your weblog the use of msn. This is an extremely smartly written article.
    I’ll make sure to bookmark it and return to learn more of your
    helpful info. Thanks for the post. I’ll definitely comeback.

    Look at my blog post: title loans (Mitchel)

  7. Denisha

    My programmer is trying to persuade me to movfe to .net from PHP.
    I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using WordPress on numerous websites for about
    a year and am concerned aboyt switching to another platform.
    I have heatd very good things about
    Is there a wayy I can transfer all my wordpress posts into it?
    Any kind of help would be greatly appreciated!

    Here is my website :: title loans (Denisha)

  8. Rhea

    Hi there would you mind sharing whidh blog platform you’re working with?
    I’m looking to start my own blog in the near future but I’m
    having a hard time choosing betwee BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask iss because your layout seems different
    then mosst blogs and I’m looking for something completsly unique.
    P.S Sorry for getting off-topic but I had tto ask!

    Also visit my webpage :: title loans (Rhea)

  9. Norma

    First of all I woul lke to say excellent blog!
    I had a quick question in which I’d like to assk if youu don’t mind.

    I was curious to know how you center yourself and clear your
    mind before writing. I have had a hard time clearing my thoughts in getting mmy ideas out there.
    I truly do enjoy writing however it just sems like the first 10 to 15 minutes are
    lost simply just trying to figyre out how too begin. Any suggestions
    or tips? Thanks!

    Feel free to visit my homepage: title loans [Norma]

  10. Concetta

    I am sure this piece of writing has touched all
    the internet visitors, its really really pleasant post on building up nnew weblog.

    Alsso visit my web site … title loans; Concetta,

Leave a Reply

Your email address will not be published.