Capacitor fading led on a digital pin


hello folks!
i trying make primitive sound reactive led. want led fade down nicely after activated. have been doing programmatically using analogwrite decided try out using capacitor instead might able free spare analog pin.
when connect capacitor positive foot of led , ground , excite 5v supply fades down like, when try , excite digital out pin there no fade causes me think when pin low grounded causing "suck up" spare juice. there way around little conundrum? many thanks!

aha! did per:
code: [select]
// setup function runs once when press reset or power board
void setup() {
  // initialize digital pin led_builtin output.
  pinmode(7, output);
}

// loop function runs on , on again forever
void loop() {
  pinmode(7, output);
  digitalwrite(7, high);   // turn led on (high voltage level)
  delay(1000);                       // wait second
  pinmode(7, input);   // turn led off making voltage low
  delay(1000);                       // wait second
}


are there problems arise changing status of pins on fly this? thanks!


Arduino Forum > Using Arduino > General Electronics > Capacitor fading led on a digital pin


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino DUE ADC to DAC Piezo 30 Khz-100Khz

Indesign and MathType fonts