chipKIT® Development Platform

Inspired by Arduino™

Chipkit MX3 Pin selection

Created Mon, 24 Feb 2014 19:24:38 +0000 by czirjek


czirjek

Mon, 24 Feb 2014 19:24:38 +0000

Hello, I am a beginner in this domain and i have a question about selecting the pins on my ChipKIT MX3 because i have 2 pmods (Pmod GYRO and Pmod Wifi). In my case i want to use them on the same board but both of them are selected to pin JE and i don't know how to put the Gyro to the pin JA for example. I attach my source code and header files. The main code is this:

#include <DSPI.h>
#include <GYRO.h>

const int Int1Pin = 12;
const int Int2Pin = 13;

int16_t xAxis = 0;
int16_t yAxis = 0;
int16_t zAxis = 0;
int8_t temp = 0;

GYRO myGYRO;

void setup() {
  Serial.begin(9600);
  Serial.println("Pmod Gyro test started");
  
  //Set interrupt pins as inputs
  pinMode(Int1Pin, INPUT);
  pinMode(Int2Pin, INPUT);
  
  myGYRO.begin();
  //Set XH Threshold Register
  myGYRO.setThsXH(0x0F);
  //Enable Interrupt 
  myGYRO.enableInt1(INT1_XHIE);
  //myGYRO.disableInt2();
  
  myGYRO.enableInt2(REG3_I2_DRDY);
  //myGYRO.disableInt2();
}

void loop() {
   
  //check int1 pin
  if(digitalRead(Int1Pin))
  {
    Serial.println("Int1 was triggerd");
    //Read InterruptSrc1 Reg to clear interrupt
    myGYRO.getInt1Src();
  }
  
  //check int2 pin
  if(digitalRead(Int2Pin))
  {
    Serial.println("Int2 was triggerd");
    xAxis = myGYRO.getX();
    yAxis = myGYRO.getY();
    zAxis = myGYRO.getZ();
    temp = myGYRO.getTemp();
    
    Serial.print("X Axis: ");
    Serial.println(xAxis, DEC);
    Serial.print("Y Axis: ");
    Serial.println(yAxis, DEC);
    Serial.print("Z Axis: ");
    Serial.println(zAxis, DEC);
    Serial.print("Temp: ");
    Serial.println(temp, DEC);
  }
  
  delay(1000);  
}

Please help me! Lot of thanks.