Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: OctoWS2811 use pins 14,20,21 as analoge input

  1. #1
    Junior Member
    Join Date
    Jul 2017
    Posts
    2

    OctoWS2811 use pins 14,20,21 as analoge input

    Hi everyone,

    Im pretty new to programming.
    My project is to build an soundactive led wall. For this Im using the teensy 3.2 with the audio adapotor and the OctoWS2811 libary.
    I also want to controll the whole setup via 5 potis which should connect to analoge pins.

    Without sending data to the strips i receive usefull values on all the pins.
    But as soon as I want stream data to the led strips (ws2812) the analoge values on the pins A0 and A6 (have also tried A7) go crazy.

    Is there any possibility to use the pins 14,20,21 as analoge inputs?



    //PINS
    #define PIN_POTI_1 A0
    #define PIN_POTI_2 A1
    #define PIN_POTI_3 A2
    #define PIN_POTI_4 A3
    #define PIN_POTI_5 A6
    #define NPOTIS 5

    #define RED 0xFF0000
    #define GREEN 0x00FF00
    #define BLUE 0x0000FF
    #define YELLOW 0xFFFF00
    #define PINK 0xFF1088
    #define ORANGE 0xE05800
    #define WHITE 0xFFFFFF


    const int ledsPerStrip = 30;

    DMAMEM int displayMemory[ledsPerStrip * 6];
    int drawingMemory[ledsPerStrip * 6];

    const int config = WS2811_GRB | WS2811_800kHz;

    OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);

    void setup()
    {
    leds.begin();
    leds.show();
    //Start up Serial for USB debugging
    Serial.begin(9600); //Serial USB for debugging
    while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
    }
    Serial.println("setup done! new");
    }

    void loop()
    {
    int val_poti[NPOTIS];

    val_poti[0] = analogRead(PIN_POTI_1);
    val_poti[1] = analogRead(PIN_POTI_2);
    val_poti[2] = analogRead(PIN_POTI_3);
    val_poti[3] = analogRead(PIN_POTI_4);
    val_poti[4] = analogRead(PIN_POTI_5);

    for (int i = 0; i < NPOTIS; i++) {
    Serial.print("Poti number: ");
    Serial.print(i+1);
    Serial.print(" Raw value: ");
    Serial.print(val_poti[i]);
    Serial.print(" ||| ");
    }

    Serial.println(" ");
    colorWipe(RED, 0);
    delay(1000);
    }

    void colorWipe(int color, int wait)
    {
    for (int i = 0; i < leds.numPixels(); i++) {
    leds.setPixel(i, color);
    leds.show();
    delayMicroseconds(wait);
    }
    }

    Thanks in advance,

    Luis

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,322
    Yes, after leds.begin(), you can use pinMode(14, INPUT_DISABLE); to turn off the output.

  3. #3
    Junior Member
    Join Date
    Jul 2017
    Posts
    2
    Thank you!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •