Skip to content

pixelEDI/attiny_lightbase

Repository files navigation

General info

Code

  • First we declare the functions for fading in and out the LEDs
  • With the function "detectTwoClapsInTimeWindow" we make sure, that the claps are at least 300ms apart from each other to get counted.
  • In the loop:
  • if the second clap follows within 1000ms the LEDs will be turned on and/or off in three different ways. And then the clap counter starts at zero.
  • otherwise nothing happens and the clap counter starts at zero.

Hardware

  • This DIY nightlight is a practical example of using transistors with ATtinys since we address 4 LEDs with one GPIO, with max 40mA per pin.
  • The light is switched on and off from the hardware side with a built-in reed switch and a magnet.
  • The microphone functions as a sound detector so you can change between three colors by clapping.
  • We added 100 Ω resistors for the LEDs and 1k Ω for the transistor (on the base).
  • The transistors are a NPN Type with 100mA IC

Verdrahtung

3D Case

Get the Case: thingiverser URL Case

About

ATtiny project for a sound-controlled light

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages