Skip to content

Instantly share code, notes, and snippets.

@GSE-UP
Created June 29, 2018 18:11
Show Gist options
  • Save GSE-UP/11c3636c537c47b2a18fe91c95eda051 to your computer and use it in GitHub Desktop.
Save GSE-UP/11c3636c537c47b2a18fe91c95eda051 to your computer and use it in GitHub Desktop.
#include <SPI.h>
#include <DMD2.h>
#include <fonts/Arial_Black_16.h> //include the library of the fonts used on the LED display
#include <string.h>
//starts LED display with 3 columns and 1 line of matrix (1x1 matrix = 16x16 LEDs)
SoftDMD dmd(3,1);
DMD_TextBox box(dmd);
String save=""; //starts a string responsible to save the data
void setup() {
//set the brightness of the LED display
dmd.setBrightness(30);
//set the font used on the LED display
dmd.selectFont(Arial_Black_16);
dmd.begin();
//set the data rate in bits per second for serial data transmission
Serial.begin(4800);
}
void loop(){
//if there's something on Serial
if(Serial.available()>0){
//reset save
save=" PV SYSTEM VOLTAGE: ";
//while there's something on Serial
while(Serial.available())
//reads string and saves it
save+=(char)Serial.read();
}
//print each letter of 'save' on LED display
for(int i=0;i<save.length();i++){
box.print(save[i]);
//pause for 0.3 second
delay(300);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment