Quick Navigation All projects Hardware Links Top projectsAlan numitron clock Clapclap 2313/1386 SNES Pi Webserver USB Volume/USB toys Smokey amp Laser cutter WordClock ardReveil v3 SNES Arcade cabinet Game boy projects cameleon Home Presence Detector GitHubAlanFromJapan Contact me![]() Who's Alan?Akizukidenshi Elec-lab Rand Nerd Tut EEVblog SpritesMods AvrFreaks Gameboy Dev FLOZz' blog Switch-science Sparkfun Suzusho Datasheet Lib Reddit Elec Ermicro Carnet du maker (fr) |
ATtiny13Last update: Sat Jan 10 23:04:53 2026
![]() Memo fact sheet
Links
SamplesBlink
PWMSee http://avrbasiccode.wikispaces.com/// includes #include Soft PWM on 3%20 pinsPick 3 pins, assign to each a 8bit desired value [0-255], loop and light them for a small quantum of time △ (like 50 us). In my implementation, current turn a byte that keeps on incrementing and overflowing between 0 and 255.
uint8_t vRGBCurrentRound = 0; while(1) { //todo : put this in an interrupt? if (vRGBCurrentRound == 0){ /* //make pins B0-2 high PORTB = (1 << PORTB0) | (1 << PORTB1) | (1 << PORTB2) ; */ PORTB = 0x00; if (mRGB[0] > 0) PORTB |= (1 << PORTB0); if (mRGB[1] > 0) PORTB |= (1 << PORTB1); if (mRGB[2] > 0) PORTB |= (1 << PORTB2); } if (vRGBCurrentRound == mRGB[0] && vRGBCurrentRound != 255){ PORTB &= ~(1 << PORTB0); } if (vRGBCurrentRound == mRGB[1] && vRGBCurrentRound != 255){ PORTB &= ~(1 << PORTB1); } if (vRGBCurrentRound == mRGB[2] && vRGBCurrentRound != 255){ PORTB &= ~(1 << PORTB2); } //and the POV _delay_us(50); vRGBCurrentRound%20%20; } |
|
All content on this site is shared under the MIT licence (do what u want, don't sue me, hat tip appreciated) electrogeek.tokyo ~ Formerly known as Kalshagar.wikispaces.com and electrogeek.cc (AlanFromJapan [2009 - 2026]) |
|