week3. Distance sensor+LED+Tone

I tried to focus on understanding the connection of circuit and codes.

 

img_5560

Q. I connected the distance sensor to Digital pin and it works. But I realized that distance sensor might be an analog sensor. Do I supposed to connected to Analog pin? or doesn’t matter…?fullsizerender-2

Q2. I set as  Digital(OUTPUT) -> LED -> Resistor -> Ground.

But in most of the other examples, it was Digital(OUTPUT) -> Resistor-> LED-> Ground.

What is the difference?

 


Code

screen-shot-2016-09-27-at-11-18-59-pm screen-shot-2016-09-27-at-11-19-14-pm screen-shot-2016-09-27-at-11-20-23-pm screen-shot-2016-09-27-at-11-19-42-pm

 

 


+ I tried to add sound (tone) using speaker..

img_5580

At first, It was a little bit confused to use tone() function to make a different pitch in each LED output.

screen-shot-2016-09-28-at-10-06-21-am

 

week3. Distance sensor+LED+Tone

Leave a Reply

Your email address will not be published. Required fields are marked *