Created
February 28, 2021 05:18
-
-
Save siddharthdeore/a9c955d23fb258dbdc628ec76ce72528 to your computer and use it in GitHub Desktop.
Square wave generator for Anmol's Clock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void setup(){ | |
| DDRD = DDRD | B00000100; // Sets pin 2 as Output | |
| } | |
| void loop(){ | |
| while (1){ | |
| // Pin 2 High for 6ms | |
| PORTD = PORTD | 0b00000100; | |
| delayMicroseconds(6000); | |
| // Pin 2 Low for 194ms | |
| PORTD = PORTD & 0b11111011; | |
| delayMicroseconds(194000); | |
| // Total 200ms Duty Cycle | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment