tag:blogger.com,1999:blog-3806671262592789292.post6273198471385335041..comments2022-03-29T23:50:29.046-07:00Comments on I Am Nomad: ATtiny PWM (updated)Matt16060936http://www.blogger.com/profile/02579182147273916867noreply@blogger.comBlogger25125tag:blogger.com,1999:blog-3806671262592789292.post-74933097088049818712018-05-11T03:58:23.478-07:002018-05-11T03:58:23.478-07:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/06909453523095613225noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-22879263498047066642018-01-01T22:55:10.631-08:002018-01-01T22:55:10.631-08:00Posted here too, in case Dr. Hack is deaded:
http...Posted here too, in case Dr. Hack is deaded:<br /><br /><a href="http://clpbrd.it/c/PJEQ8NOd9RtvejYpBqKN" rel="nofollow">http://clpbrd.it/c/PJEQ8NOd9RtvejYpBqKN</a>johny radiohttps://www.blogger.com/profile/12704652353529073530noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-69258235468218837032018-01-01T22:47:16.552-08:002018-01-01T22:47:16.552-08:00Here's complete code to cycle PWM on 3 LED.
Va...Here's complete code to cycle PWM on 3 LED.<br />Validated on Digispark ATTiny85 board. <br /><br />https://paste.drhack.net/?2a8e4c29f1c49dec#qL7An5xTPsMV7jLoXSwgdhp8sei2e+V9v0omkwhGo4s=johny radiohttps://www.blogger.com/profile/12704652353529073530noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-38573060524979220592018-01-01T21:23:36.668-08:002018-01-01T21:23:36.668-08:00this line seems to be missing open-paren:
DDRB = ...this line seems to be missing open-paren:<br /><br />DDRB = 1<255) r=0;johny radiohttps://www.blogger.com/profile/12704652353529073530noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-32992742093147220942017-05-22T21:16:17.407-07:002017-05-22T21:16:17.407-07:00I am trying to use an ATtiny85 to control 3 separa...I am trying to use an ATtiny85 to control 3 separate 12V LED strips. I have a 5v Voltage Regulator to power the ATtiny85 and am using PB0, PB1, PB4 as my PWM pins to control three TIP122 that act as my switch for each 12V strip.<br /><br />Any other recommendations as to how to get this to work?<br /><br />I am retiring from the USAF after 20 years and I am using this project in my retirement shadow box (traditional box that has all of my military medals to remember my career by). Please help!! Thanks!!Anonymoushttps://www.blogger.com/profile/10739149616804471707noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-31349763099253845862017-03-01T15:36:38.313-08:002017-03-01T15:36:38.313-08:00Much later yet and this is still quite helpful to ...Much later yet and this is still quite helpful to start understanding that there are a lot of things that are not available when programming MCUs at a higher level.<br />A big thanks to the author (and to the link that brought me here (http://www.technoblogy.com/show?LE0).<br />It took me weeks to find out how to get 3 pwm from an attiny85 so that I don't have to use a Nano or Pro mini to control a simple rgb led.<br />There are a lot of comments on arduino.cc stating that the attiny85 only have 2 pwm.<br />I can't imagine what is the reason for analogWrite() only to work with pins 5 and 6 (physical chip pins).Vascohttps://www.blogger.com/profile/12369525326431752790noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-41569792668139830952016-05-14T10:56:03.195-07:002016-05-14T10:56:03.195-07:00It's few years later and this again helped - t...It's few years later and this again helped - this time to me.<br />Thanks a lot!Sanchohttps://www.blogger.com/profile/13617052862716027203noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-89044967604295082382016-04-05T05:30:39.434-07:002016-04-05T05:30:39.434-07:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/01583565865276164461noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-65805925367429161692016-04-05T05:04:20.050-07:002016-04-05T05:04:20.050-07:00I have an Attiny45 with a vcc=5 V, I uploaded the ...I have an Attiny45 with a vcc=5 V, I uploaded the code but it is just working with a pwm frequency of 4kHz.<br />Do you know what is wrong with my system?<br />I have a led with a 1 kohm resistor at ocr1b.<br />I want the pwm at the maximum frequency. Around 31 kHz.<br />Thanks for your help.Anonymoushttps://www.blogger.com/profile/01583565865276164461noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-68547065606370264202014-08-30T21:04:13.286-07:002014-08-30T21:04:13.286-07:00Confirmed, those lines are completely removed by t...Confirmed, those lines are completely removed by the compiler (I'm still on AVR Studio 5).Matt16060936https://www.blogger.com/profile/02579182147273916867noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-51377239920806942452014-08-30T20:49:38.808-07:002014-08-30T20:49:38.808-07:00(sorry about the delay, didn't get a notificat...(sorry about the delay, didn't get a notification that people left comments)<br />That's a very good question :) I bet the compiler optimizes those statements out completely. I should really look at the intermediate assembly and see if it did.Matt16060936https://www.blogger.com/profile/02579182147273916867noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-15434078273665806042014-08-30T20:48:09.359-07:002014-08-30T20:48:09.359-07:00(sorry about the delay, didn't get a notificat...(sorry about the delay, didn't get a notification that people left comments)<br />The ATtiny 25/45/85 default to 1MHz but I set the 8MHz fuse. Since I don't touch the PLLCSR register, and set no prescalars, all my PWM outputs run at internal-oscillator speed (8MHz). Hope that helps; better late than never :)Matt16060936https://www.blogger.com/profile/02579182147273916867noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-77545891749396943152014-07-18T04:31:13.335-07:002014-07-18T04:31:13.335-07:00May I ask you, why do you have this code in there ...May I ask you, why do you have this code in there ?<br />if (++r>255) r=0;<br />if (++g>255) g=0;<br />if (++b>255) b=0;<br />these variables are unsigned char[0-255] and you are not able to go over that number, so when your r equals to 255 next value after incrementation is going to be 0, not 256, therefore you will never reach your conditions.Anonymoushttps://www.blogger.com/profile/09748870083525242990noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-88930391075130926812014-06-17T08:47:28.113-07:002014-06-17T08:47:28.113-07:00So what frequency is the pwm signal...? I need low...So what frequency is the pwm signal...? I need lower than 500hz for a led driver i have. I have 490Hz on a Arduino uno, but want to use a ATtiny...<br />LedLight4mehttps://www.blogger.com/profile/06376751483603252906noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-21684077974562906622013-05-09T02:27:59.581-07:002013-05-09T02:27:59.581-07:00Your article contains precise comments that helped...Your article contains precise comments that helped me understand attiny's registries. Now I can read the datasheet and see what all this is about. Thank you!!kadeixhttps://www.blogger.com/profile/14536218617252292874noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-54193155554356593472013-05-03T09:31:50.156-07:002013-05-03T09:31:50.156-07:00In my above comment, the includes didn't come ...In my above comment, the includes didn't come across in the blogger comments but the includes are <br /><br />avr/io.h <br />util/delay.hJimmy Patrickhttps://www.blogger.com/profile/06274958768624895919noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-32238639061958471022013-05-02T22:45:17.770-07:002013-05-02T22:45:17.770-07:00熱血阿重
For Arduino IDE, take the variables out o...熱血阿重 <br /><br />For Arduino IDE, take the variables out of 'main()'; call main 'setup()' until you get to the 'loop forever' part, then call that 'loop(). <br /><br />then it will work fine in Arduino. hereis what I used:<br /><br /><br /><br />#define F_CPU 8000000<br /><br />#include <br />#include <br />uint8_t r=0, g=85, b=170;<br /><br />void setup()<br />{<br /> <br /> uint8_t r=0, g=85, b=170;<br /> DDRB = 1<255) r=0;<br /> if (++g>255) g=0;<br /> if (++b>255) b=0;<br /> OCR0A = r;<br /> OCR0B = g;<br /> OCR1B = b;<br /> _delay_ms(10);<br /> }<br /><br /><br />I just converted it to Arduino style, and took out the comments for breviity. <br /><br /><br />Jimmy Patrickhttps://www.blogger.com/profile/06274958768624895919noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-58698705727746066612013-04-18T20:55:55.421-07:002013-04-18T20:55:55.421-07:00I use AVRStudio (which is free from www.atmel.com)...I use AVRStudio (which is free from www.atmel.com) to build all of my ATtiny projects. I upload the binary file using an Olimex AVR-ISP500. It's worked really well for me, too.Matt16060936https://www.blogger.com/profile/02579182147273916867noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-75921152554402944802013-04-16T21:28:38.653-07:002013-04-16T21:28:38.653-07:00excuse me,
may i ask how to compile and upload thi...excuse me,<br />may i ask how to compile and upload this code to attiny85.<br />i'm an arduino IDE user,<br />so i'm not familiar with this kind of code.<br />Edward Chenhttps://www.blogger.com/profile/01518352752489284567noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-70675321095898679252013-02-22T20:11:33.143-08:002013-02-22T20:11:33.143-08:00This comment has been removed by the author.GBarnabichttps://www.blogger.com/profile/08231340331034170569noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-18935140905323740092012-04-30T08:32:53.516-07:002012-04-30T08:32:53.516-07:00Much appreciated :)Much appreciated :)wezsidehttps://www.blogger.com/profile/01734583661179025439noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-53294280436131530682012-04-30T07:13:38.560-07:002012-04-30T07:13:38.560-07:00I didn't apply any specific license, but as th...I didn't apply any specific license, but as the owner of this original work I hereby release it freely for anyone to use :)Matt16060936https://www.blogger.com/profile/02579182147273916867noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-70028532681098275592012-04-30T06:07:10.333-07:002012-04-30T06:07:10.333-07:00This looks awesome. What is the license for this c...This looks awesome. What is the license for this code. Is it opensource as I might want to use it in one of my projects?wezsidehttps://www.blogger.com/profile/01734583661179025439noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-38723264984254749772012-04-30T05:56:07.742-07:002012-04-30T05:56:07.742-07:00Glad I could help :) For what it's worth, I no...Glad I could help :) For what it's worth, I now rely completely on datasheets and don't know how I lived without them. The trick is to keep like 3 instances of the datasheet open at the same time so you can cross-reference pins, registers and higher-level functionality at the same time.Matt16060936https://www.blogger.com/profile/02579182147273916867noreply@blogger.comtag:blogger.com,1999:blog-3806671262592789292.post-43928049331670124222012-04-28T11:02:25.740-07:002012-04-28T11:02:25.740-07:00Beautiful!! I have just started programming AVR...Beautiful!! I have just started programming AVR's with GCC and this is EXACTLY what I have been looking for to get me started. Thank you :-)ArmandAanekrehttps://www.blogger.com/profile/14419354660008340433noreply@blogger.com