2 Replies Latest reply on Dec 22, 2014 5:39 AM by ek

    Using PWM4 on Arduino Expansion Board from Arduino IDE?

    ek

      I have an Arduino shield (ZUMO - robot car) that requires PWM control on Pin 9 and 10 (PWM3 and PWM4), respectively.

      Is it possible to control these PWM pins from Arduino IDE?

       

      I understand that the swizzler jumpers may need to be manipulated (I tried some). But, I could not find any document to do this from Arduino IDE.

      If it can be done by several "system" commands for Linux from Arduino IDE, it is also acceptable.

       

      Below is a simplified sketch to use both PWM3 and PWM4. I hope someone has done this, already.

       

      #include <Arduino.h>

       

      #define PIN_LED     13

      #define PIN_PWM_9    9

      #define PIN_PWM_10  10

       

      void setup(){

        pinMode(PIN_LED, OUTPUT);

        pinMode(PIN_PWM_9, OUTPUT);

        pinMode(PIN_PWM_10, OUTPUT);

      }

       

      void loop()

      {

        //

        digitalWrite(PIN_LED, HIGH);

        for (int i = 0; i <= 400; i++)

        {

          analogWrite(PIN_PWM_9, i * 51 / 80);

          delay(2);

        }

        //

        digitalWrite(PIN_LED, LOW);

        for (int i = 0; i <= 400; i++)

        {

          analogWrite(PIN_PWM_10, i * 51 / 80);

          delay(2);

        }

        //

        delay(500);

      }

      Thanks!