Software Delay Functions
Explanation
This code listing shows how to create a 1ms delay in the Arduino board. Greater delays can be created with the other function.
/* Delay function that create a 1 ms delay. It is optimized for a 16 Mhz clock * clock cycle. Do not forget that it is only a software delay function */ void delay_ms(void){ int i; for(i=880u; i != 0; i--); } /* Function to create bigger delays. Uses delay_ms as the basic function */ void delay(uint8_t tms){ uint8_t i; for(i = tms; i != 0; i--){ delay_ms(); } }
page_revision: 1, last_edited: 1209611784|%e %b %Y, %H:%M %Z (%O ago)





