Actualiser tuner30ans.ino

This commit is contained in:
Pierre GIMENEZ 2023-11-02 17:13:04 +01:00
parent 7f41aaccf8
commit b6e6ae196f

View File

@ -1,9 +1,13 @@
//Import the needed FastLED library
#include <FastLED.h>
#include <MIDIElements.h>
//These variables allow you to specify how the strip will behave
#define NUM_LEDS 12 //This number decides how many of the strip's LEDs the code will use
const int ledLength = 1; //This number decides how many LEDs will be turned on at once
boolean debug = false; // print to serial instead of midi
boolean secondary = true; // enable secondary midi messages
int midiChannel = 1; // midi channel number
//Define and initiate global variables
CRGB leds[NUM_LEDS];
@ -11,13 +15,18 @@ CRGB leds[NUM_LEDS];
int sensorPin = 7;
int ledValue;
int sensorValue;
Potentiometer pot(sensorPin, midiChannel, 3, secondary, debug); // knob on pin 45 (A7)
void setup() {
// initiate the LED strip
FastLED.addLeds<WS2811, DATA_PIN>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
pinMode(sensorPin, INPUT);
}
void loop() {
pot.read(); // read knob and send midi messages
//Read value from any sensor
sensorValue = analogRead(sensorPin);
@ -30,4 +39,6 @@ void loop() {
//Set and turn on desired LED
leds[ledValue] = CRGB::White;
FastLED.show();
}
usbMIDI.read(); // read all the incoming midi messages
}