Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 18672

Using PWM4 on Arduino Expansion Board from Arduino IDE?

$
0
0

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!


Viewing all articles
Browse latest Browse all 18672

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>