Week 03 Lab

 

Lab: Tone Output Using An Arduino

Issue: I forgot to solder cables to my speaker, I would complete the assignment before class

  1. Play Tones

Breadboard view of an Arduino Nano connected to two force sensing resistors (FSRs) and a speaker.

Force Sensor Input Range: 0-1000

Code:

 

2. Musical Instrument

Code:

 

Question:

  • Is it possible to map a desired pitch range for each force sensor using #pitch?
  • map without #pitch:

int sensorReading1 = analogRead(A0);

int sensorReading2 = analogRead(A1);

int sensorReading3 = analogRead(A2);

float frequency1 = map(sensorReading1, 100, 1000, 100, 350);

float frequency2 = map(sensorReading2, 100, 1000, 351, 700);

float frequency3 = map(sensorReading3, 100, 1000, 701, 1000);

 

Lab: Servo Motor Control with an Arduino

Issue: I forgot to connect a header pin to the motor

Breadboard view of an Arduino Nano 33 IoT connected to a voltage divider input circuit on analog in pin 0 and a servomotor on digital pin 9. A fixed 10-kilohm resistor is attached to analog in pin 0 and to ground on the Arduino. A variable resistor is attached to analog in pin 0 and to Vin pin (+5 volts). A servomotor's control wire is attached to digital pin D3. The motor's voltage input is attached to Vin, and its ground is attached to ground on the Arduino. A 10-microfarad capacitor is mounted across the 3.3V and ground buses.

Code:

 

Leave a Reply

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