I have the simplest GPS code works well on Moteino.
But none of the pins work on MEGA, from 12 ~19,
Any advise?
Thank you.
I found a solution online. Now SoftSerial is working on pin 12, 13, 15, A2, A3 (did not test the rest)...
original pin_arduino.h for Moteino Mega..
#define digitalPinToPCICR(p) (((p) >= 0 && (p) < NUM_DIGITAL_PINS) ? (&PCICR) : ((uint8_t *)0))
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 1 : (((p) <= 15) ? 3 : (((p) <= 23) ? 2 : 0)))
#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0))))
#define digitalPinToPCMSKbit(p) ((p) % 8)
Modified to..
#define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 31) ? (&PCICR) : ((uint8_t *)0))
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 1 : (((p) <= 15) ? 3 : (((p) <= 23) ? 2 : 0)))
#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK1) : (((p) <= 15) ? (&PCMSK3) : (((p) <= 23) ? (&PCMSK2) : (((p) <= 31) ? (&PCMSK0) : ((uint8_t *)0)))))
#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 15) ? ((p) - 8) : (((p) <= 23) ? ((p) - 16) : ((p) - 24))))
Not sure what I am doing. Felix can you verify please???
MoteinoMEGA has a second hardware serial device you can use (Serial1). So why bother with software serial?
Hi Felix,
Somehow, my Serial1 does not work. I have no idea why.
Can you please check the modification I did for the pins_arduino.h and confirm that they are legit.
Thank you as always,
Donald
The MoteinoMEGA core I have released already has the correct pins definition. So it feels wrong that you have to edit the pins definitions file. I have already gone through this effort which is verified to work and I advise you to use the published core instead of hacking into the core Arduino classes.