Professional Documents
Culture Documents
VU Arduino Nov 21
VU Arduino Nov 21
VU Arduino Nov 21
#include <Adafruit_NeoPixel.h>
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to
int zeroingValue = 0;
int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
int delayval = 10; // timing delay in milliseconds
int oldneoPinVal = 0;
int fromoffsetVal = 0;
int redColor = 0;
int greenColor = 0;
int blueColor = 0;
void setup() {
pinMode(neoPinVal, OUTPUT);
pinMode(analogOutPin, OUTPUT);
// Initialize the NeoPixel library.
pixels.begin();
Serial.begin(9600);
delay(500);
initval = analogRead(A0);
delay(500);
void loop() {
// read the analog in value:
//neoPinVal = 10*log(neoPinVal);
// if(neoPinVal - oldneoPinVal > 3) neoPinVal = oldneoPinVal +1;
// if(oldneoPinVal - neoPinVal > 3) neoPinVal = oldneoPinVal -1;
// change the analog out value:
analogWrite(analogOutPin, outputValue);
// print the results to the Serial Monitor:
//setColor();
}
// This sends the updated pixel color to the hardware.