Feather M0 Pinouts

Hello,

I am trying to transfer a project from an arduino UNO to the Feather M0

Currently I am Using:

BMP180: SD Breakout : Neo6m gps:
3v 3v
3v GND GND
gnd CS ->10 rx->5
SCL->SCL DI ->11 Tx->6
SDA->SDA DO ->12
CLK -> 13

#include <TinyGPS.h>
#include <SD.h>
#include <Wire.h>
#include <SPI.h>
#include "HardwareSerial.h"
#include "SFE_BMP180.h"
#include "RH_RF95.h"

File main_folder; // initialize folder for saving
File dataFile; // initialize sd file
const int chipSelect = 10; // CS pin on sd card module
int prev_file_indx = 0; // used for file naming
String fileName = "000";

//const float station_elev = 00.0;
//const float p_0 = 1017.3 * 100.0;

//GPS Variables for File date Time
int year;
byte month, day, hour, minute, second;
double baseline;//baseline PRESSURE
double T; //Temperature variable

//Initialize Sensors
SFE_BMP180 bmp;
TinyGPS gps;

#define RFM95_CS 8
#define RFM95_RST 4
#define RFM95_INT 3
#define RF95_FREQ 433.0

//Function for setting date/Time for File
void dateTime(uint16_t* date, uint16_t* time)
{
  *date = FAT_DATE(year, month, day);
  *time = FAT_TIME(hour - 4, minute, second);
}

RH_RF95 rf95(RFM95_CS, RFM95_INT);
#define Serial SERIAL_PORT_USBVIRTUAL
 
void setup() {
  //initialize sensors
  bool status;
  Serial.begin(9600);
  
  Serial1.begin(9600);
  Wire.begin();
  
  if (!SD.begin(chipSelect)) {
    while (1);
  }
  //Start Measurments


  status = bmp.begin();
  if (!status) {
    while (1);
  }

    //Initialize SD folder
    main_folder = SD.open("/");
    fileName = sd_saver(main_folder);
    
    SdFile::dateTimeCallback(dateTime);
      dataFile = SD.open("DATA" + fileName + ".txt", FILE_WRITE);
  if (dataFile) {
    dataFile.println(F("Date, Time, Pressure, Altitude, Lattitude, longitude, VCC"));
    dataFile.close();
  }
    pinMode(RFM95_RST, OUTPUT);
  digitalWrite(RFM95_RST, HIGH);
  
  // manual reset
  digitalWrite(RFM95_RST, LOW);
  delay(10);
  digitalWrite(RFM95_RST, HIGH);
  delay(10);
 
  while (!rf95.init()) {
    Serial.println("LoRa radio init failed");
    Serial.println("Uncomment '#define SERIAL_DEBUG' in RH_RF95.cpp for detailed debug info");
    while (1);
  }
  Serial.println("LoRa radio init OK!");
 
  // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM
  if (!rf95.setFrequency(RF95_FREQ)) {
    Serial.println("setFrequency failed");
    while (1);
  }
  Serial.print("Set Freq to: "); Serial.println(RF95_FREQ);
  
  // Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on
 
  // The default transmitter power is 13dBm, using PA_BOOST.
  // If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then 
  // you can set transmitter powers from 5 to 23 dBm:
  rf95.setTxPower(23, false);
  }

  int16_t packetnum = 0;  // packet counter, we increment per xmission

  void loop() {
    double P;
    float flat, flon;
    unsigned long age;
    char sz[32];
    // sd save section
    bool newData = false;
    unsigned long chars;
    unsigned short sentences, failed;
    
    // Parse GPS Data
    for (unsigned long start = millis(); millis() - start < 2000;) {
      while (Serial1.available()) {
        char c = Serial1.read();// Read GPS Data
        //Serial.write(c);
        if (gps.encode(c)) // Checking For Valid GPS Data
          newData = true;
      }
    }

    if (newData) {
      gps.f_get_position(&flat, &flon, &age);//Parce Locataion Data
      gps.crack_datetime(&year, &month, &day, &hour, &minute, &second);//Parce Time data
      sprintf(sz, "%02d/%02d/%02d, %02d:%02d:%02d", month, day, year, hour, minute, second);
      Serial.print(sz);//Date Time for Data Recording
      Serial.print(", ");
      Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
      Serial.print(", ");
      Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
      Serial.print(", ");
      Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
      Serial.print(", ");
      Serial.print(bmp.getPressure(),5);
      Serial.print(", ");
      Serial.print(bmp.altitude() * 3.28084, 2);//altitude in feet 2 decimal places
      //Serial.print(", ");
     // Serial.print(readVcc(), DEC);//VIN Value
      Serial.print('\n');
      
      //Write To Data File
      dataFile = SD.open("DATA" + fileName + ".txt", FILE_WRITE);
      if (dataFile) {
        dataFile.print(sz);
        dataFile.print(", ");
        dataFile.print(bmp.getPressure(),5);
        dataFile.print(", ");
        dataFile.print(bmp.altitude() * 3.28084, 2);//altitude in feet 2 decimal places
        dataFile.print(", ");
        dataFile.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
        dataFile.print(", ");
        dataFile.println(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
        //dataFile.print(", ");
        //dataFile.println(readVcc(), DEC);
        dataFile.close();
      }
      else {
        Serial.println("Not Writing");
      }
    }
      delay(10000); // Wait 1 second between transmits, could also 'sleep' here!
  Serial.println("Transmitting..."); // Send a message to rf95_server
  
  char radiopacket[20] = ("hello World ");
  itoa(packetnum++, radiopacket+13, 10);
  Serial.print("Sending "); Serial.println(radiopacket);
  radiopacket[19] = 0;
  
  Serial.println("Sending...");
  delay(10);
  rf95.send((uint8_t *)radiopacket, 20);
 
  Serial.println("Waiting for packet to complete..."); 
  delay(10);
  rf95.waitPacketSent();
  // Now wait for a reply
  uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
  uint8_t len = sizeof(buf);
 
  Serial.println("Waiting for reply...");
  if (rf95.waitAvailableTimeout(1000))
  { 
    // Should be a reply message for us now   
    if (rf95.recv(buf, &len))
   {
      Serial.print("Got reply: ");
      Serial.println((char*)buf);
      Serial.print("RSSI: ");
      Serial.println(rf95.lastRssi(), DEC);    
    }
    else
    {
      Serial.println("Receive failed");
    }
  }
  else
  {
    Serial.println("No reply, is there a listener around?");
  }
  }



//Function For Naming Files 
  String sd_saver(File dir) {
    while (true) {
      // iterate all files to ensure no overwrites
      File entry = dir.openNextFile();
      if (!entry) {
        break;
      }
      // naming routine
      String entry_name = entry.name();
      if ((entry_name.substring(4, 7)).toInt() >= prev_file_indx) {
        prev_file_indx = (entry_name.substring(4, 7)).toInt() + 1;
        if (prev_file_indx >= 100) {
          fileName = String(prev_file_indx);
        } else if (prev_file_indx >= 10) {
          fileName = "0" + String(prev_file_indx);
        } else {
          fileName = "00" + String(prev_file_indx);
        }

      }
      entry.close();

    }
    return fileName;
  }

I followed the adafruit page for Transfering sketches but unfortunately I am not getting any output. Am i Missing something in the code? Or Is my pinout incorrect? I am not trying to send anything besides the hello world message yet. I just want to get the SD card recording GPS and Barometer data.
Thank you.

Not certain since you did not supply a link to your specific board but the SPI pins appear to be marked SCK, MOS and MISO, not 11/12/13 per the atMega328 standard.

WattsThat:
Not certain since you did not supply a link to your specific board but the SPI pins appear to be marked SCK, MOS and MISO, not 11/12/13 per the atMega328 standard.

Thanks for the Reply. I ended up reading this on the adafruit guide and switching to these pins But unfortunately The result was the same. But at least now I know that something is incorrect in my Code rather than the pinout.

WattsThat:
Not certain since you did not supply a link to your specific board

adafruit Feather M0 LoRa