How to Control Led Matrix Using Bluetooth
by zayedalam in Circuits > Arduino
426 Views, 2 Favorites, 0 Comments
How to Control Led Matrix Using Bluetooth
Hi guys!today I have created a simple project by how to control led matrix using bluetooth
Materials needed:
Supplies
1)arduino(uno,mega,nano,etc.)
2)ledmatrix 8x8 3)bluetooth module(HC-05) 4)wires 5)breadboard
Step1:assembling Parts
Step2:Coding
Here is the code:
#include<LedControl.h>
int DIN = 12;
int CS = 10;
int CLK = 11;
int row=0;
int col=0;
int temp=0;
int data=0;
LedControl lc=LedControl(DIN,CLK,CS,1);
void setup() {
lc.shutdown(0,false);
lc.setIntensity(0,5);
lc.clearDisplay(0);
Serial.begin(9600); }
void loop() {
if(Serial.available() > 0)
{ data = Serial.read();// it returns ascii value if we send one in the phone
if(data < 96)
{
if(temp==0) {
row=data-48;
temp=1; }
else
col=data-48; }
else if(data=='n') {
lc.setLed(0,row,col,true);
Serial.println('n');
Serial.println(row);
Serial.println(col);
temp=0; }
else if(data=='f') {
lc.setLed(0,row,col,false);
Serial.println('f');
Serial.println(row);
Serial.println(col);
temp=0; }
else if(data=='r') lc.clearDisplay(0); }
}
Caution:If you are uploading the code,Please unwire the rx and tx pins from arduino or it will blow
Step3:wiring
Here is the schematics
Step4:enjoy
Now you can draw anything in the led matrix