Angie Kim

NYU ITP ‘24

Welcome to my Blog :-)
If you wanna know about me more...

︎︎︎ ︎︎︎ Check these out ︎︎︎ ︎︎︎

Portfolio Website ︎︎︎

Email︎︎︎
Linkedin ︎︎︎
Instagram︎︎︎


Week 3 : Analog Input + Outputs

Sept 26, 2022





Week3: more analog input and outputs


FSR + tone + servomotor


comment me here :)https://docs.google.com/spreadsheets/d/1-W06EclvrzTsQrbldnvYTIj56PC2BN_Xc2jTjxwCo6A/edit#gid=0



-> Issue report

https://itp.nyu.edu/physcomp/labs/labs-arduino-digital-and-analog/tone-output-using-an-arduino/

-> REF to A0 (image)







Tone Output




* always need to check the LED’s longer side and shorter side....




Tone output using an Arduino

with 1 FSR

void setup() {
}

void loop() {
int sensorReading = analogRead(A0);

float frequency = map(sensorReading, 200, 900, 100, 1000); -> changed it to (..,100, 200, 400, 600) because my sensor only detected <850

tone(8, frequency, 10);
delay(10);
}



with 3 FSR

void loop() {
for (int thisSensor = 0; thisSensor < 3; thisSensor++) {

int sensorReading = analogRead(thisSensor);

if (sensorReading > threshold) {
tone(speakerPin, notes[thisSensor], noteDuration);




Servo Motor Control using an Arduino

#include "Servo.h"

Servo servoMotor;

int servoPin = 9;
long lastMoveTime = 0;

void setup() {
Serial.begin(9600);
servoMotor.attach(servoPin);  
pin 9 to the servo object
}

void loop() {
int analogValue = analogRead(A0);
Serial.println(analogValue);

int servoAngle = map(analogValue, 0, 1023, 0, 179);
-> changed it to (.., 0, 850, 0, 179) because my sensor only detected <850

if (millis() - lastMoveTime > 20) {
servoMotor.write(servoAngle);
lastMoveTime = millis();
}
}






Have a wonderful day :)

Random thought outlives  here ︎︎︎