Now the pulse is only 64ns that is 60 times faster than before. I zoom in and now the pulse is a lot shorter. I upload this second code using register control. But why so long? There is no delay between HIGH and LOW so why isn’t this in the range of ns? Well, that’s because we are using digital write which is a function of Arduino and this takes a while to execute. Each 5ms we have a short pulse but if I make a zoom in and I measure the width of this pulse, we can see it is 4 us. I upload this code to the Arduino and connect my oscilloscope to pin D9. 1 second divided by 16Mhz is 62 nanoseconds. This Arduino works at a speed of 16Mhz, and since there is no delay between the LOW and HIGH state of the pin, this code should create a very, very, short pulse. The void loop will repeat itself over and over. Then in the void loop, using digitalWrite(), I put that pin to HIGH and then with no delay in between I put the pin to LOW and then I place a delay of 5ms. In an empty Arduino code, I set pin 9 as output.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |