Infineon Team
Published © MIT

XMC For Arduino

Here's how you can integrate and program Infineon's XMC Microcontroller using the Arduino IDE.

BeginnerProtip1 hour1,246
XMC For Arduino

Things used in this project

Story

Read more

Schematics

XMC4700 Relax Kit

Fritzing file

XMC2Go

Fritzing file

Code

XMC for Arduino Example

Arduino
This is the example used in section 5 to toggle LED 1 of the XMC1100 Boot Kit
#define LED_1 25 //Pin Number extracted from (https://github.com/Infineon/XMC-for-Arduino/wiki/XMC1100-Boot-Kit) pinout diagram section

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(LED_1, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:

  digitalToggle(LED_1);
  Serial.println(digitalRead(LED_1));
  delay(2000);
}

XMC for arduino example servo motors.ino.ino

Arduino
This is the code used in the second example (controlling 5 Servo motors with the XMC4700 Relax Kit) in section 5
#include <Servo.h>

Servo Alpha;    // create servo object to control a servo
Servo Bravo;    // create servo object to control a servo
Servo Charlie;  // create servo object to control a servo
Servo Delta;    // create servo object to control a servo
Servo Echo;     // create servo object to control a servo


int pos = 0;  // variable to store the servo position

void setup() {

  Alpha.attach(34);  // attaches the servo on pin 34 to the servo object
  Bravo.attach(70);  
  Charlie.attach(94);  
  Delta.attach(36);  
  Echo.attach(37);  

}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) {  // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    Charlie.write(pos);  // tell servo to go to position in variable 'pos'
    Alpha.write(pos);
    Bravo.write(pos);
    Delta.write(pos);
    Echo.write(pos);

    delay(15);  // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) {  // goes from 180 degrees to 0 degrees

    Charlie.write(pos);  // tell servo to go to position in variable 'pos'
    Alpha.write(pos);
    Bravo.write(pos);
    Charlie.write(pos);
    Delta.write(pos);
    Echo.write(pos);
    
    delay(15);  // waits 15ms for the servo to reach the position
  }
}

Servo Library for XMC µControllers

Library used in the example in section 5 to control servo motors

Credits

Infineon Team

Infineon Team

75 projects • 116 followers

Comments