2 Replies Latest reply on Nov 9, 2015 8:43 PM by dunex_1

    MRAA Range Mapping

    dunex_1

      How do I achieve this in MRAA

       

      /* Map an analog value to 8 bits (0 to 255) */

      void setup() {}

       

      void loop()

      {

        int val = analogRead(0);

        val = map(val, 0, 1023, 0, 255);

        analogWrite(9, val);

      }


      I want to map the duty-cycle setup instead of  from 0.0 to 1.0, I want to map it to start from 0 to 255. Any help or point to where I can find how to do this will be much appreciated