This file contains 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
#include "MIDIUSB.h" | |
const byte TOTAL_BUTTONS = 16; | |
const byte BUTTONS_PIN[TOTAL_BUTTONS] = {2,3,4,5,6,7,8,9,10,11,12,A0,A1,A2,A3,A4}; | |
const byte BUTTONS_PITCH[TOTAL_BUTTONS] = {36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}; | |
byte channel = 0; // 16 channels (0-15) Reported to the user as 1-16 | |
void setup() { | |
for (byte i = 0; i < TOTAL_BUTTONS; i++) { | |
pinMode(BUTTONS_PIN[i], INPUT_PULLUP); |
This file contains 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
// Before | |
<div class="card"> | |
<div class="message"> | |
<p class="warning-text">...</p> | |
</div> | |
</div> | |
// After | |
<div class="card"> | |
<p class="message warning-text">...</p> |
This file contains 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
<style> | |
.card { | |
background-color: var(--card-color); | |
} | |
</style> | |
<ul> | |
<li class="card" style="--card-color: red;"></li> | |
<li class="card" style="--card-color: blue;"></li> | |
</ul> |
This file contains 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
#include "MIDIUSB.h" | |
const int BUTTON_PIN = 2; | |
// Note "C2"! See https://github.com/arduino/tutorials/blob/master/ArduinoZeroMidi/PitchToNote.h | |
const int BUTTON_PITCH = 36; | |
void setup() { | |
pinMode(BUTTON_PIN, INPUT_PULLUP); | |
} |
This file contains 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
// The setup function runs once when you press reset or power the board | |
void setup() { | |
// Initialize digital pin LED_BUILTIN as an output. | |
pinMode(LED_BUILTIN, OUTPUT); | |
} | |
// The loop function runs over and over again forever | |
void loop() { | |
// Turn the LED on (HIGH is the voltage level) | |
digitalWrite(LED_BUILTIN, HIGH); |
This file contains 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
#include "MIDIUSB.h" | |
const byte TOTAL_BUTTONS = 16; | |
// All the Arduino pins used for buttons, in order. | |
const byte BUTTONS_PIN[TOTAL_BUTTONS] = {2,3,4,5,6,7,8,9,10,11,12,A0,A1,A2,A3,A4}; | |
// Every pitch corresponding to every Arduino pin. Each note has an associated numeric pitch (frequency scale). | |
// See https://github.com/arduino/tutorials/blob/master/ArduinoZeroMidi/PitchToNote.h | |
const byte BUTTONS_PITCH[TOTAL_BUTTONS] = {36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51}; | |
// Current state of the pressed buttons. | |
byte currentRead[TOTAL_BUTTONS]; |
This file contains 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
const int BUTTON_PIN = 2; | |
// The setup function runs once when you press reset or power the board | |
void setup() { | |
// Initialize button pin as a pull-up input. | |
pinMode(BUTTON_PIN, INPUT_PULLUP); | |
// Initialize digital pin LED_BUILTIN as an output. | |
pinMode(LED_BUILTIN, OUTPUT); | |
} |
This file contains 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
const int BUTTON_PIN = 2; | |
void setup() { | |
pinMode(BUTTON_PIN, INPUT); | |
pinMode(LED_BUILTIN, OUTPUT); | |
} | |
void loop() { | |
int buttonState = digitalRead(BUTTON_PIN); | |
digitalWrite(LED_BUILTIN, buttonState); |