Let me know if this is the wrong forum and I'll shift it! It's kind of a hardware/software issue.
I'm trying to mount a DMD on an Arduino (Uno) Boe Bot to create a moving signboard. I'm using the DMD library, which works great for displaying scrolling text. However, I'm getting what I think is a pin conflict on pin 10 - after the DMD/TimerOne initialisation code runs, the servos are unusable.
In the DMD library I found that pin 10 is used:
#warning CHANGE THESE TO SEMI-ADJUSTABLE PIN DEFS!
//Arduino pins used for the display connection
#define PIN_DMD_nOE 9 // D9 active low Output Enable, setting this low lights all the LEDs in the selected rows. Can pwm it at very high frequency for brightness control.
#define PIN_DMD_A 6 // D6
#define PIN_DMD_B 7 // D7
#define PIN_DMD_CLK 13 // D13_SCK is SPI Clock if SPI is used
#define PIN_DMD_SCLK 8 // D8
#define PIN_DMD_R_DATA 11 // D11_MOSI is SPI Master Out if SPI is used
//Define this chip select pin that the Ethernet W5100 IC or other SPI device uses
//if it is in use during a DMD scan request then scanDisplayBySPI() will exit without conflict! (and skip that scan)
#define PIN_OTHER_SPI_nCS 10
Based on this thread I tried changing PIN_OTHER_SPI_nCS to pin 11 but it doesn't fix the issue. This is my setup function. I can make the robot move up until that DMD Configuration section runs, but after that the servos don't respond.
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
/* Boe bot */
attachServos();
/* DMD configuration */
// ScanDMD is called every 5ms, refreshing the DMD display
Timer1.initialize(5000);
Timer1.attachInterrupt(ScanDMD);
dmd.clearScreen(true); // true = turn all LEDs off (instead of on) when clearing the display
dmd.selectFont(SystemFont5x7);
// Set DMD to display default message until a message arrives
currentMessage = defaultText;
}
This is the attachServos() function:
void attachServos() {
// Attach signals to servo pins (pins 12 and 10 - unused by DMD)
servoRight.attach(12);
servoLeft.attach(10);
}
Boe Bot usually uses pins 12 and 13 for the servos, but I changed 13->10 because it looks like DMD needs 13.
I'd really appreciate any help if it's possible to reserve pin 10 for the servo! I think the issue might be with TimerOne - reading this page it looks like the intialize()
function requires pin 10.