Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: Arduino MIDI
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2024-01-01 18:13:39
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* Send midi data */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- #include <EasyButton.h>
- #include <MIDI.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- void sendMidiData(void);
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t Btn1_PushButton_PIN_D2 = 2;
- /****** DEFINITION OF LIBRARY CLASS INSTANCES*****/
- EasyButton Btn1_PushButton(Btn1_PushButton_PIN_D2);
- MIDI_CREATE_DEFAULT_INSTANCE();
- void setup(void)
- {
- // put your setup code here, to run once:
- Btn1_PushButton.begin();
- MIDI.begin(MIDI_CHANNEL_OMNI);
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- Btn1_PushButton.read();
- if (Btn1_PushButton.isPressed())
- {
- // Call the function to send MIDI data
- sendMidiData();
- }
- }
- void sendMidiData(void)
- {
- // Code to send MIDI data
- // Replace with your own implementation
- // Example: Sending a note-on message for note C4 (MIDI note number 60) with velocity 100
- MIDI.sendNoteOn(60, 100, 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement