Skip to content

Instantly share code, notes, and snippets.

@khthana
khthana / LED Serial Control.ino
Last active June 13, 2019 11:24
LED Serial Control
int LED_Pin = 13;
String SerialString = "";
void setup() {
Serial.begin(115200);
pinMode(LED_Pin, OUTPUT);
}
void loop() {
while (Serial.available()) {
#include "LedControl.h"
#include "FontLEDClock.h"
LedControl lc = LedControl(11, 13, 10, 4); // DIN,CLK,CS,Number of LED Module
uint8_t intensity = 8;
uint8_t hour = 12, minute = 10, second = 0; //Variable Clock mode
void setup()
{
int devices = lc.getDeviceCount(); /* find no of LED modules */
/*
Example Timer1 Interrupt
Flash LED every second
*/
#define ledPin 13
int timer1_counter;
int t1=0;
void setup()
{
#include "LedControl.h"
#include "FontLEDClock.h" // Font library
LedControl lc=LedControl(11,13,10,4); // DIN,CLK,CS,Number of LED Module
uint8_t intensity = 1;
unsigned long delaytime=50; // time to updates of the display
void setup() {
int devices=lc.getDeviceCount(); // find no of LED modules
void print_tiny_char(uint8_t x, uint8_t y, char c)
{
uint8_t dots;
if (c >= 'A' && c <= 'Z' || (c >= 'a' && c <= 'z') ) { c &= 0x1F; } // A-Z maps to 1-26
else if (c >= '0' && c <= '9') { c = (c - '0') + 32; }
else if (c == ' ') { c = 0; } // space
else if (c == '.') { c = 27; } // full stop
else if (c == ':') { c = 28; } // colon
else if (c == '\''){ c = 29; } // single quote mark
else if (c == '!') { c = 30; } // single quote mark
void plot (uint8_t x, uint8_t y, uint8_t value) {
//select which matrix depending on the x coord
uint8_t address;
if (x >= 0 && x <= 7) { address = 3; }
if (x >= 8 && x <= 15) { address = 2; x = x - 8; }
if (x >= 16 && x <= 23) { address = 1; x = x - 16;}
if (x >= 24 && x <= 31) { address = 0; x = x - 24;}
if (value == 1) {
//Modify From https://www.instructables.com/id/Arduino-Dot-Matrix-Game-Console/
#include "LedControl.h"
// connection to MAX7219 (data, clik, load, #of dispplay)
LedControl lc = LedControl(11,13,10,1);
// direction
const int TOP = 0;
const int RIGHT = 1;
const int BOTTOM = 2;
#include <SPI.h>
const int CS_PIN = 10; // SPI /SS
const int CLK_PIN = 13; // SPI SCK
const int DIN_PIN = 11; // SPI MOSI
void MAX7219_write_reg( uint8_t addr, uint8_t data ) {
digitalWrite( CS_PIN, LOW );
SPI.transfer( addr );
SPI.transfer( data );
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#include <IRremote.h>
#include <IRremoteInt.h>
#define VR_Pin A0
#define LDR_Pin A1
#define LM35_Pin A2
//We always have to include the library
#include "LedControl.h"
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.