Saturday, June 13, 2020
Analog Output Experimentation
I'm still trying to figure out this project, but hopefully I learn my mistake soon!
const int ledPin = 9;
const int ldrPin = A0;
int brightness = 0;
int fadeAmount = 5;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(ldrPin, INPUT);
}
void loop() {
int ldrStatus = analogRead(ldrPin);
if (ldrStatus <= 400) {
analogWrite(ledPin, brightness);
// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;
// reverse the direction of the fading at the ends of the fade:
if (brightness <= 0 || brightness >= 255) {
fadeAmount = -fadeAmount;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);;
}
else {
digitalWrite (ledPin, LOW);
}
}
Capsense Library Experimentation
The code I used was the Capacitive Sensor Sketch example from the Capsense Library.
Final Prank Documentation
Capsense Library
Capacitive Sensing
This was quite interesting as I got to understand the value of capacitive sensing and can recognize the technologies that possibly use this type of sensing. I used a 1M ohm resistor and connected it to my x-acto knife. The serial monitor was still confusing to read because of the unstable grounding but I was able to witness the changes in the readings so I'm happy it was evidently working.
My code:
#include <CapacitiveSensor.h>
CapacitiveSensor cs_4_2 = CapacitiveSensor(4,2); // 10 megohm resistor between pins 4 & 2, pin 2 is sensor pin, add wire, foil
void setup(){
cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example Serial.begin(9600);
}
void loop(){
long start = millis();
long total1 = cs_4_2.capacitiveSensor(30);
Serial.print(millis() - start); // check on performance in milliseconds
Serial.print("\t"); // tab character for debug window spacing
Serial.println(total1); // print sensor output 1
delay(10); // arbitrary delay to limit data to serial port
}
Knolling a Film Camera
Analog Output Experimentation
![]() |
| Add caption |



