Fabrication - Physical Computing Focus: Serial Outputs & Sensors
The difference between analog and digital input as well as output, so i decided to use the potentiometer along with two LEDs and a servo motor. I got inspired from a conversation with one of my friends, we discussed the context of a woman's body within today's beauty standards. How every little comment/compliment we receive brands us in a way whether it's be too skinny or too curvy or anything, it's just strange. We let these comments get to us and define us. So I wanted to take that conversation and make something out of it and with Halloween coming close by why not up the ante, add some scary elements to it.
Here's what I made.
The code used to program both the motor and LEDs.
The finished look....this turned out much creeper than I planned.
It does look creepy and she seems to be furious! Great application of analog input/output and it seems like everything is working well. It's amazing how expressive LEDs and servos are in your project.
A few small things in the code:
- You can remove "int sensor = analogRead(A0);" because the sensor value is not used in the code.
- The if statement is only for the servo so it needs to be closed right after myServo.write(angle); currently, the closing curly bracket is at the end.
- If you want your program to be shorter, you can use analogWrite(2, onTime) instead of:
digitalWrite(2,HIGH); delayMicroseconds(onTime); digitalWrite(2,LOW); delayMicroseconds(1023-onTime);
However, it's cool you discovered and tried the way you did, which shows how analogWrite() works.