hi All
i don't really know where to start with this one.
i bought a couple of modules for sending basic text to a set of led modules namely max7219 led, i connected everything up as per tutorial and the basic message in the code appeared as i would have expected. so the LED side is fine.
connected via bluetooth terminal from my Phone no issue with this finding the bluetooth module and connecting. i then sent a message that was supposed to update the led array and Nothing happened.
so i had to investigate the issue, so stat the research
- check the i/o of the bluetooth module
found an app that would communicate and show RX and TX response (Term for BT) it fit the bill so installed and followed several ways of testing the module
i now know that if you connect RX and TX to form a loop it sends and receives ok as it shows in term 1 sent and 1 received blue 1 for sent red 1 for received.
- set up a simple circuit to turn one LED off and on (code attached)
#include <SoftwareSerial.h>
char data = 0; //Variable for storing received data
void setup()
{
Serial.begin(9600); //Sets the data rate in bits per second (baud) for serial data transmission
pinMode(13, OUTPUT); //Sets digital pin 13 as output pin
SoftwareSerial mySerial(10,11); // RX, TX
}
void loop()
{
if(Serial.available() > 0) // Send data only when you receive data:
{
data = Serial.read(); //Read the incoming data and store it into variable data
Serial.print(data); //Print Value inside data in Serial monitor
Serial.print("\n"); //New line
if(data == '1') //Checks whether value of data is equal to 1
digitalWrite(13, HIGH); //If value is 1 then LED turns ON
else if(data == '0') //Checks whether value of data is equal to 0
digitalWrite(13, LOW); //If value is 0 then LED turns OFF
}
}
ok so using the app that was used in the tutorial i thought all would be ok only to find nothing happened i am absolutely stumped as the tutorial video shows it working
i can send the code via serial monitor to turn on the led but if sent via bluetooth nothing appears in serial monitor
i have reset the HC05 module to factory settings and can communicate in AT mode so i cant see a problem there
i have a voltage divider between TX on the arduino and RX on the HC06 and can see 3.2V on the RX pin of the HC05.
so i am not sure where to go as i have exhausted any ideas i can come up with
it could be a duff module but i'm not sure now
below is the code for the max7219 i am eventually going to use PLEASE note the pin outs are as i would have them set i have changed and tried different i/o pins to see if there was a board problem
In the code i have removed some of the Character set due to length of message
// based on an original sketch by Arduino forum member "danigom"
// http://forum.arduino.cc/index.php?action=profile;u=188950
//#include <pgmspace.h>
#include <LedControl.h>
#include <avr/pgmspace.h>
// virtual serial lib, used with bluetooth
const int numDevices = 4; // number of MAX7219s used
const long scrollDelay = 50; // adjust scrolling speed
unsigned long bufferLong [14] = {0};
LedControl lc=LedControl(10,11,12,numDevices);
const unsigned char scrollText[] PROGMEM ={
" Frying my Noodles again !!!! "};
void setup(){
for (int x=0; x<numDevices; x++){
lc.shutdown(x,false); //The MAX72XX is in power-saving mode on startup
lc.setIntensity(x,8); // Set the brightness to default value
lc.clearDisplay(x); // and clear the display
}
}
void loop(){
scrollMessage(scrollText);
//scrollFont();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const unsigned char font5x7 [] PROGMEM = { //Numeric Font Matrix (Arranged as 7x font data + 1x kerning data)
//prog_uchar font5x7 [] PROGMEM = { //Numeric Font Matrix (Arranged as 7x font data + 1x kerning data)
B00000000, //Space (Char 0x20)
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
6,
B10000000, //!
B10000000,
B10000000,
B10000000,
B00000000,
B00000000,
B10000000,
2,
B10100000, //"
B10100000,
B10100000,
B00000000,
B00000000,
B00000000,
B00000000,
4,
};
void scrollFont() {
for (int counter=0x20;counter<0x80;counter++){
loadBufferLong(counter);
delay(500);
}
}
// Scroll Message
void scrollMessage(const unsigned char * messageString) {
int counter = 0;
int myChar=0;
do {
// read back a char
myChar = pgm_read_byte_near(messageString + counter);
if (myChar != 0){
loadBufferLong(myChar);
}
counter++;
}
while (myChar != 0);
}
// Load character into scroll buffer
void loadBufferLong(int ascii){
if (ascii >= 0x20 && ascii <=0x7f){
for (int a=0;a<7;a++){ // Loop 7 times for a 5x7 font
unsigned long c = pgm_read_byte_near(font5x7 + ((ascii - 0x20) * 8) + a); // Index into character table to get row data
unsigned long x = bufferLong [a*2]; // Load current scroll buffer
x = x | c; // OR the new character onto end of current
bufferLong [a*2] = x; // Store in buffer
}
byte count = pgm_read_byte_near(font5x7 +((ascii - 0x20) * 8) + 7); // Index into character table for kerning data
for (byte x=0; x<count;x++){
rotateBufferLong();
printBufferLong();
delay(scrollDelay);
}
}
}
// Rotate the buffer
void rotateBufferLong(){
for (int a=0;a<7;a++){ // Loop 7 times for a 5x7 font
unsigned long x = bufferLong [a*2]; // Get low buffer entry
byte b = bitRead(x,31); // Copy high order bit that gets lost in rotation
x = x<<1; // Rotate left one bit
bufferLong [a*2] = x; // Store new low buffer
x = bufferLong [a*2+1]; // Get high buffer entry
x = x<<1; // Rotate left one bit
bitWrite(x,0,b); // Store saved bit
bufferLong [a*2+1] = x; // Store new high buffer
}
}
// Display Buffer on LED matrix
void printBufferLong(){
for (int a=0;a<7;a++){ // Loop 7 times for a 5x7 font
unsigned long x = bufferLong [a*2+1]; // Get high buffer entry
byte y = x; // Mask off first character
lc.setRow(3,a,y); // Send row to relevent MAX7219 chip
x = bufferLong [a*2]; // Get low buffer entry
y = (x>>24); // Mask off second character
lc.setRow(2,a,y); // Send row to relevent MAX7219 chip
y = (x>>16); // Mask off third character
lc.setRow(1,a,y); // Send row to relevent MAX7219 chip
y = (x>>8); // Mask off forth character
lc.setRow(0,a,y); // Send row to relevent MAX7219 chip
}
}/code]
thanks for looking i will try to resolve it but any assistance would be gratefully accepted.