Hey guys a few months ago I started learning how to code and make projects with Arduino and I'm having some issues with my first project that I cant seem to get around and I really really need help.
Right now I'm trying to make a HC-05 Bluetooth controlled led matrix using a MAX7219 LED dot matrix display.
I've seen a lot of videos that where people are able to send text via a android smartphone and have it displayed on the MAX7219 LED dot matrix display but I'm trying remove the android phone from the equation and use an Arduino connected to a HC-05 to speak to another Arduino to display a message when a specific button is pressed on the master Arduino.
I already paired and bonded the two HC-05 Bluetooth modules using the AT-commands. I have the Baud rate at 9600 for both modules. I tested the the connection with a basic push button led library and that was successful but now I'm trying to add the MAX7219 LED dot matrix display to the equation and I'm not able to get anything displaying on the MAX7219 LED dot matrix display when I push the button on the master side.
Ill post my code down below starting with the master side first. Like I stated earlier I am brand new to programming and have very little knowledge on Arduino so I apologies if I am missing some of the basic rules of programming. Thanks in advance.
Master code: #include <SoftwareSerial.h>
const int pinButton = 8;
SoftwareSerial BTSerial(0, 1); // RX | TX
void setup() {
pinMode(pinButton, INPUT);
Serial.begin(9600);
BTSerial.begin(9600);
}
void loop() {
int stateButton = digitalRead(pinButton);
if(stateButton == 1) {
BTSerial.write("1");
} else {
BTSerial.write("0");
}
delay(800);
}
}
}
// end master code
((((Slave side code with the led matrix.:)))
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
// Define hardware type, size, and output pins:
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 8
#define CS_PIN 3
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(0, 1); // RX | TX
MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
textEffect_t scrollEffect = PA_SCROLL_RIGHT;
char val = BTSerial.read();
void setup() {
Serial.begin(9600);
BTSerial.begin(9600); // HC-05 default speed in AT command more
Serial.begin(9600);
myDisplay.begin();
// Set the intensity (brightness) of the display (0-15):
myDisplay.setIntensity(10);
// Clear the display:
myDisplay.displayClear();
myDisplay.displayText("Welcome to OMA", PA_CENTER, 100, 0, PA_SCROLL_RIGHT, PA_SCROLL_RIGHT);
myDisplay.displayClear();
}
void loop()
{ if (myDisplay.displayAnimate())
{
delay(2000);
myDisplay.displayText("Welcome to OMA", PA_CENTER, 100, 0, PA_SCROLL_RIGHT, PA_SCROLL_RIGHT);
delay(3000);
myDisplay.displayReset();
}
// put your main code here, to run repeatedly:
if(BTSerial.available())
{
char val = BTSerial.read();
if(val == '0')
{
myDisplay.println("Test");
}
else if(val == '1')
{
myDisplay.print("EndTest");
}
}
}
** // end slave side code. **