Hello all. I’ve been enjoying Stefan Petrick’s self modifying code and greatly desire to insert a 10k ohm pot to control overall brightness levels. I’m having great difficulty as the micro is a Teensy 3.5, not an Arduino. I can’t figure out how to read an analog pot (10k) and write to Pin 11 (DATA) on the Teensy. I just cant find any examples. Can anyone point me in a direction towards a solution?
Partial code here:
void setup() {
Serial.begin(115200);
LEDS.addLeds<APA102, 11, 13, BGR, DATA_RATE_MHZ(8)>(leds, NUM_LEDS).setCorrection(TypicalSMD5050); // 24MHZ
// 11 DATA, 13 clock
FastLED.setBrightness(BRIGHTNESS);
Any help would be greatly appreciated.
Thank you.
marmil
(Marc Miller)
July 24, 2017, 2:47am
2
Here’s an example that used two potentiometers, one for hue and one for brightness.
//===============================================================
// hue_and_brightness_example.ino
//
// Example setup for using two potentiometers to control hue and
// brightness with FastLED.
//
// Every time the function checkKnobs() is called it will read
// the current value of both potentiometers and map those values
// to a hue and master brightness for FastLED.
//
// Marc Miller, 2015
//===============================================================
#include "FastLED.h"
#define LED_TYPE NEOPIXEL
#define DATA_PIN 6
#define NUM_LEDS 12
#define MASTER_BRIGHTNESS 255 // Set the master brigtness value [should be greater then min_brightness value].
uint8_t min_brightness = 30; // Set a minimum brightness level.
uint8_t brightness; // Mapped master brightness based on potentiometer reading.
This file has been truncated. show original
The potentiometer has pos and neg wired to the outer connections, and the analog pin wired to the middle connection, as seen here:
https://www.arduino.cc/en/tutorial/potentiometer