Hello,
I built something like a miniature space and I am trying to get a potentiometer to fade in and out of various lighting/sound situations in the space, but I am not really sure how to go about this for the code. So as the potentiometer is turned I want a certain sound file to correspond to a certain setup of leds (I have around 3-4 leds per pin). As of now I have the potentiometer set to pin A1 and the leds set to pin 3 on a teensy 3.2. Someone suggested to me that I try using something like this:
This would just be a start to the leds.
I am a beginner, so my knowledge of code is very limited. As I tested this code it says "transitionOne(); was not declared in this scope." I'm not sure how to fix this. Does anyone know how I can get this code working? Any other suggestions for going about this are greatly appreciated to.
Thank you.
I built something like a miniature space and I am trying to get a potentiometer to fade in and out of various lighting/sound situations in the space, but I am not really sure how to go about this for the code. So as the potentiometer is turned I want a certain sound file to correspond to a certain setup of leds (I have around 3-4 leds per pin). As of now I have the potentiometer set to pin A1 and the leds set to pin 3 on a teensy 3.2. Someone suggested to me that I try using something like this:
HTML:
int red = 0;
int redPin = 3;
void setup() {
pinMode(redPin, OUTPUT);
}
void loop() {
int knob = analogRead(A1);
if (knob < 50) {
transitionOne();
}
void transitionOne() {
for (int i = 0; i <255; i++);{
if (red <50){
red++;
}
else if (red = 50){
}
else{
red--;
}
}
analogWrite(redPin,red);
}
This would just be a start to the leds.
I am a beginner, so my knowledge of code is very limited. As I tested this code it says "transitionOne(); was not declared in this scope." I'm not sure how to fix this. Does anyone know how I can get this code working? Any other suggestions for going about this are greatly appreciated to.
Thank you.