This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:c4eng:fall2023:projects:ptb0 [2023/10/05 12:30] – [SPEAKER (PASSIVE BUZZER - SPEAKER WITH STICKER)] acuno | notes:c4eng:fall2023:projects:ptb0 [2023/10/05 12:32] (current) – [CODING THE SPEAKER] acuno | ||
---|---|---|---|
Line 24: | Line 24: | ||
The active speaker simply needs to be toggled on or off to work. | The active speaker simply needs to be toggled on or off to work. | ||
- | "digitalWrite (GPIO_PIN, STATE)" -- where: | + | < |
- | | + | digitalWrite (GPIO_PIN, STATE) |
- | | + | </ |
+ | Where: | ||
+ | | ||
+ | | ||
The passive speaker needs to also be given a tone, in Hz, to function. | The passive speaker needs to also be given a tone, in Hz, to function. | ||
- | "softToneWrite (GPIO_PIN, TONE), where: | + | < |
- | | + | softToneWrite (GPIO_PIN, TONE) |
- | | + | </ |
+ | Where: | ||
+ | | ||
+ | | ||
====GPIO MODE SETTING==== | ====GPIO MODE SETTING==== | ||
To initialize our GPIO pins, we use the pinMode() function with the first argument being the pin number, and the second argument being the state (input or output). | To initialize our GPIO pins, we use the pinMode() function with the first argument being the pin number, and the second argument being the state (input or output). |