Real-time BitCoin Price monitor using LED Matrix, Arduino and 1Sheeld

By on June 24, 2015

Web site:

http://www.instructables.com/id/Real-time-BitCoin-Price-monitor-using-LED-Matrix-A/

Project Summary:

Basically, this projects illustrate how update the price of BitCoin in USD in real time and displaying the price on a large LED matrix that we have hacked to let it communicate with Arduino instead of the PC.

We have faced some troubles in the project as hacking the LED matrix which was used only to interface with the PC with a dedicated software for it, but we have tried a way to control it via Arduino without the use of your PC.

Full Project:

LCD Matrix hacking
Picture of LCD Matrix hacking
arduino_rs232.png

LED Matrix connected to PC via serial cable (RS-232). All we have to do to use any software (as Docklight) that can listen to any serial COM port and display the send and the received packets between the LED Matrix and the software that comes with it that send the commands to the LED matrix. So after listing to the sent and received data, we can save them as shown in code below as arrays and then use the arduino instead of the PC to send these packets to the LED matrix through any 2 pins in Arduino that act as Serial Software.

Circuit diagram:

arduino_rs232

Bill of Materials:

55.jpg
F1W6WR6HZ6T9K9G.LARGE.jpg
arduinorev31s.jpg
426899580_005.JPG

1- LED Matrix

2- Arduino Uno

3- 1Sheeld

4- RS-232 to UART converter

5- Android Smart phone

Software & Code Snippets:

I have firstly tried to access a BitCoin API on blockchain site. You will find a sample code that get the response every 10 seconds and display it on the terminal shield.

#include <OneSheeld.h>
HttpRequest request ("https://blockchain.info/stats?format=json");
void setup() {
  OneSheeld.begin();
  request.getResponse().setOnJsonResponse(&onJson);
  request.setOnFinish(&onFinish);
  Internet.performGet(request);
}
void loop() {
}
void onFinish() {
  request.getResponse()["market_price_usd"].query();
}
void onJson (JsonKeyChain & hell,char * res) {
  Terminal.println(res);
  OneSheeld.delay(10000);
  Internet.performGet(request);
}

The next step is to add the part on the LCD Matrix. All the defined arrays at the first are the frames to get number with its location in the price of Bitcoin. I know it sounds to be so confusing but let us discus but if you have your own LED Matrix on someone you can use it, you can simply skip this part.

One important thing, if you will try this project on Arduino UNO with this LED matrix and 1Sheeld, you should comment some shields from the 1Sheeld library as shown here since the memory will be full.

#include <OneSheeld.h>
#include <SoftwareSerial.h>
byte zeroone[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x00, 0xF0, 0x3F, 0xE0, 0x1F, 0xCF, 0xCF, 0xDC, 0xEF, 0xCF, 0xCF, 0xE0, 0x1F, 0xF0, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0x63};
byte zerotwo[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x10, 0xF0, 0x3F, 0xE0, 0x1F, 0xCF, 0xCF, 0xDC, 0xEF, 0xCF, 0xCF, 0xE0, 0x1F, 0xF0, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0x73};
byte zerothree[] = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x20, 0xF0, 0x3F, 0xE0, 0x1F, 0xCF, 0xCF, 0xDC, 0xEF, 0xCF, 0xCF, 0xE0, 0x1F, 0xF0, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0x43};
byte zerofive[]  = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x40, 0xF0, 0x3F, 0xE0, 0x1F, 0xCF, 0xCF, 0xDC, 0xEF, 0xCF, 0xCF, 0xE0, 0x1F, 0xF0, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0x23};
byte zerosix[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x50, 0xF0, 0x3F, 0xE0, 0x1F, 0xCF, 0xCF, 0xDC, 0xEF, 0xCF, 0xCF, 0xE0, 0x1F, 0xF0, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0x33};
byte oneone[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x00, 0xFF, 0xFF, 0xF7, 0xEF, 0xE7, 0xEF, 0xC0, 0x0F, 0xC0, 0x0F, 0xFF, 0xEF, 0xFF, 0xEF, 0xFF, 0xFF, 0x00, 0x00, 0x40};
byte onetwo[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x10, 0xFF, 0xFF, 0xF7, 0xEF, 0xE7, 0xEF, 0xC0, 0x0F, 0xC0, 0x0F, 0xFF, 0xEF, 0xFF, 0xEF, 0xFF, 0xFF, 0x00, 0x00, 0x50};
byte onethree[] = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x20, 0xFF, 0xFF, 0xF7, 0xEF, 0xE7, 0xEF, 0xC0, 0x0F, 0xC0, 0x0F, 0xFF, 0xEF, 0xFF, 0xEF, 0xFF, 0xFF, 0x00, 0x00, 0x60};
byte onefive[]  = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x40, 0xFF, 0xFF, 0xF7, 0xEF, 0xE7, 0xEF, 0xC0, 0x0F, 0xC0, 0x0F, 0xFF, 0xEF, 0xFF, 0xEF, 0xFF, 0xFF, 0x00, 0x00, 0x00};
byte onesix[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x50, 0xFF, 0xFF, 0xF7, 0xEF, 0xE7, 0xEF, 0xC0, 0x0F, 0xC0, 0x0F, 0xFF, 0xEF, 0xFF, 0xEF, 0xFF, 0xFF, 0x00, 0x00, 0x10};
byte twoone[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x00, 0xEF, 0x8F, 0xCF, 0x0F, 0xDE, 0x6F, 0xDC, 0xEF, 0xD9, 0xEF, 0xC3, 0xCF, 0xE7, 0xCF, 0xFF, 0xFF, 0x00, 0x00, 0x60};
byte twotwo[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x10, 0xEF, 0x8F, 0xCF, 0x0F, 0xDE, 0x6F, 0xDC, 0xEF, 0xD9, 0xEF, 0xC3, 0xCF, 0xE7, 0xCF, 0xFF, 0xFF, 0x00, 0x00, 0x70};
byte twothree[] = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x20, 0xEF, 0x8F, 0xCF, 0x0F, 0xDE, 0x6F, 0xDC, 0xEF, 0xD9, 0xEF, 0xC3, 0xCF, 0xE7, 0xCF, 0xFF, 0xFF, 0x00, 0x00, 0x40};
byte twofive[]  = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x40, 0xEF, 0x8F, 0xCF, 0x0F, 0xDE, 0x6F, 0xDC, 0xEF, 0xD9, 0xEF, 0xC3, 0xCF, 0xE7, 0xCF, 0xFF, 0xFF, 0x00, 0x00, 0x20};
byte twosix[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x50, 0xEF, 0x8F, 0xCF, 0x0F, 0xDE, 0x6F, 0xDC, 0xEF, 0xD9, 0xEF, 0xC3, 0xCF, 0xE7, 0xCF, 0xFF, 0xFF, 0x00, 0x00, 0x30};
byte threeone[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x00, 0xEF, 0xDF, 0xCF, 0xCF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xC0, 0x0F, 0xE2, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x60};
byte threetwo[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x10, 0xEF, 0xDF, 0xCF, 0xCF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xC0, 0x0F, 0xE2, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x70};
byte threethree[] = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x20, 0xEF, 0xDF, 0xCF, 0xCF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xC0, 0x0F, 0xE2, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x40};
byte threefive[]  = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x40, 0xEF, 0xDF, 0xCF, 0xCF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xC0, 0x0F, 0xE2, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x20};
byte threesix[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x50, 0xEF, 0xDF, 0xCF, 0xCF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xC0, 0x0F, 0xE2, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x30};
byte fourone[]    = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x00, 0xFC, 0xFF, 0xF8, 0xFF, 0xF2, 0xFF, 0xE6, 0xEF, 0xC0, 0x0F, 0xC0, 0x0F, 0xFE, 0xEF, 0xFF, 0xFF, 0x00, 0x00, 0x41};
byte fourtwo[]    = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x10, 0xFC, 0xFF, 0xF8, 0xFF, 0xF2, 0xFF, 0xE6, 0xEF, 0xC0, 0x0F, 0xC0, 0x0F, 0xFE, 0xEF, 0xFF, 0xFF, 0x00, 0x00, 0x51};
byte fourthree[]  = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x20, 0xFC, 0xFF, 0xF8, 0xFF, 0xF2, 0xFF, 0xE6, 0xEF, 0xC0, 0x0F, 0xC0, 0x0F, 0xFE, 0xEF, 0xFF, 0xFF, 0x00, 0x00, 0x61};
byte fourfive[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x40, 0xFC, 0xFF, 0xF8, 0xFF, 0xF2, 0xFF, 0xE6, 0xEF, 0xC0, 0x0F, 0xC0, 0x0F, 0xFE, 0xEF, 0xFF, 0xFF, 0x00, 0x00, 0x01};
byte foursix[]    = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x50, 0xFC, 0xFF, 0xF8, 0xFF, 0xF2, 0xFF, 0xE6, 0xEF, 0xC0, 0x0F, 0xC0, 0x0F, 0xFE, 0xEF, 0xFF, 0xFF, 0x00, 0x00, 0x11};
byte fiveone[]    = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x00, 0xC1, 0xDF, 0xC1, 0xCF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDC, 0x0F, 0xDE, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x60};
byte fivetwo[]    = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x10, 0xC1, 0xDF, 0xC1, 0xCF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDC, 0x0F, 0xDE, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x70};
byte fivethree[]  = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x20, 0xC1, 0xDF, 0xC1, 0xCF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDC, 0x0F, 0xDE, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x40};
byte fivefive[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x40, 0xC1, 0xDF, 0xC1, 0xCF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDC, 0x0F, 0xDE, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x20};
byte fivesix[]    = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x50, 0xC1, 0xDF, 0xC1, 0xCF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDC, 0x0F, 0xDE, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x30};
byte sixone[]     = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x00, 0xF0, 0x1F, 0xE0, 0x0F, 0xCD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xFC, 0x0F, 0xFE, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x60};
byte sixtwo[]     = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x10, 0xF0, 0x1F, 0xE0, 0x0F, 0xCD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xFC, 0x0F, 0xFE, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x70};
byte sixthree[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x20, 0xF0, 0x1F, 0xE0, 0x0F, 0xCD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xFC, 0x0F, 0xFE, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x40};
byte sixfive[]    = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x40, 0xF0, 0x1F, 0xE0, 0x0F, 0xCD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xFC, 0x0F, 0xFE, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x20};
byte sixsix[]     = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x50, 0xF0, 0x1F, 0xE0, 0x0F, 0xCD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xFC, 0x0F, 0xFE, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x30};
byte sevenone[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x00, 0xCF, 0xFF, 0xCF, 0xFF, 0xDF, 0x0F, 0xDE, 0x0F, 0xDC, 0xFF, 0xC1, 0xFF, 0xC3, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x70};
byte seventwo[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x10, 0xCF, 0xFF, 0xCF, 0xFF, 0xDF, 0x0F, 0xDE, 0x0F, 0xDC, 0xFF, 0xC1, 0xFF, 0xC3, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x60};
byte seventhree[] = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x20, 0xCF, 0xFF, 0xCF, 0xFF, 0xDF, 0x0F, 0xDE, 0x0F, 0xDC, 0xFF, 0xC1, 0xFF, 0xC3, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x50};
byte sevenfive[]  = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x40, 0xCF, 0xFF, 0xCF, 0xFF, 0xDF, 0x0F, 0xDE, 0x0F, 0xDC, 0xFF, 0xC1, 0xFF, 0xC3, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x30};
byte sevensix[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x50, 0xCF, 0xFF, 0xCF, 0xFF, 0xDF, 0x0F, 0xDE, 0x0F, 0xDC, 0xFF, 0xC1, 0xFF, 0xC3, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x20};
byte eightone[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x00, 0xE2, 0x1F, 0xC0, 0x0F, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xC0, 0x0F, 0xE2, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x62};
byte eighttwo[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x10, 0xE2, 0x1F, 0xC0, 0x0F, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xC0, 0x0F, 0xE2, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x72};
byte eightthree[] = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x20, 0xE2, 0x1F, 0xC0, 0x0F, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xC0, 0x0F, 0xE2, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x42};
byte eightfive[]  = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x40, 0xE2, 0x1F, 0xC0, 0x0F, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xC0, 0x0F, 0xE2, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x22};
byte eightsix[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x50, 0xE2, 0x1F, 0xC0, 0x0F, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xC0, 0x0F, 0xE2, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x32};
byte nineone[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x00, 0xE3, 0xFF, 0xC1, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xCF, 0xC0, 0x1F, 0xE0, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0x70};
byte ninetwo[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x10, 0xE3, 0xFF, 0xC1, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xCF, 0xC0, 0x1F, 0xE0, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0x60};
byte ninethree[] = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x20, 0xE3, 0xFF, 0xC1, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xCF, 0xC0, 0x1F, 0xE0, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0x50};
byte ninefive[]  = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x40, 0xE3, 0xFF, 0xC1, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xCF, 0xC0, 0x1F, 0xE0, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0x30};
byte ninesix[]   = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x50, 0xE3, 0xFF, 0xC1, 0xEF, 0xDD, 0xEF, 0xDD, 0xEF, 0xDD, 0xCF, 0xC0, 0x1F, 0xE0, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0x20};
byte point[] = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x30, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x60};
byte space[] = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x60, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x30};
byte u[]     = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x70, 0xC0, 0x1F, 0xC0, 0x0F, 0xFF, 0xEF, 0xFF, 0xEF, 0xFF, 0xEF, 0xC0, 0x0F, 0xC0, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x30};
byte s[]     = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x80, 0xE7, 0x9F, 0xC3, 0x8F, 0xD9, 0xEF, 0xDD, 0xEF, 0xDC, 0xEF, 0xC6, 0x0F, 0xE7, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0xE2};
byte d[]     = {0xCC ,0x00, 0x01, 0x89, 0x15, 0x01, 0x90, 0xDF, 0xEF, 0xC0, 0x0F, 0xC0, 0x0F, 0xDF, 0xEF, 0xCF, 0xCF, 0xE0, 0x1F, 0xF0, 0x3F, 0xFF, 0xFF, 0x00, 0x00, 0xF0};
SoftwareSerial mySerial(10, 11); // RX, TX
HttpRequest request ("https://blockchain.info/stats?format=json");
void setup() {
  OneSheeld.begin();
  request.getResponse().setOnJsonResponse(&onJson);
  request.setOnFinish(&onSuccess);
  mySerial.begin(38400);
  Internet.performGet(request);
}void loop() {
}void send_point()
{
  mySerial.write(point, sizeof(point));
}void send_usd()
{
  mySerial.write(space, sizeof(space));
  delay(15);
  mySerial.write(u, sizeof(u));
  delay(15);
  mySerial.write(s, sizeof(u));
  delay(15);
  mySerial.write(d, sizeof(u));
}void onSuccess()
{
  request.getResponse()["market_price_usd"].query();
}
void onJson (JsonKeyChain & hell,char * res)
{
  test( res[0] , 1);
  OneSheeld.delay(15);
  test( res[1] ,2);
  OneSheeld.delay(15);
  test( res[2] ,3);
  OneSheeld.delay(15);
  send_point();
  OneSheeld.delay(15);
  test( res[4] ,5);
  OneSheeld.delay(15);
  test( res[5] ,6);
  OneSheeld.delay(15);
  send_usd();
  OneSheeld.delay(100);
  OneSheeld.delay(10000);
  Internet.performGet(request);
}
void test(char num, byte index)
{
  switch (num) { 
  case '0':
    switch (index)
    {
    case 1:
      mySerial.write(zeroone, sizeof(zeroone));
      break;
    case 2:
      mySerial.write(zerotwo, sizeof(zerotwo));
      break;
    case 3:
      mySerial.write(zerothree, sizeof(zerothree));
      break;
    case 5:
      mySerial.write(zerofive, sizeof(zerofive));
      break;
    case 6:
      mySerial.write(zerosix, sizeof(zerosix));
      break;
    }
    break;
    
  case '1':
    switch (index)
    {
    case 1:
      mySerial.write(oneone, sizeof(oneone));
      break;
    case 2:
      mySerial.write(onetwo, sizeof(onetwo));
      break;
    case 3:
      mySerial.write(onethree, sizeof(onethree));
      break;
    case 5:
      mySerial.write(onefive, sizeof(onefive));
      break;
    case 6:
      mySerial.write(onesix, sizeof(onesix));
      break;
    }
    break;
  
  case '2':
    switch (index)
    {
    case 1:
      mySerial.write(twoone, sizeof(twoone));
      break;
    case 2:
      mySerial.write(twotwo, sizeof(twotwo));
      break;
    case 3:
      mySerial.write(twothree, sizeof(twothree));
      break;
    case 5:
      mySerial.write(twofive, sizeof(twofive));
      break;
    case 6:
      mySerial.write(twosix, sizeof(twosix));
      break;
    }
    break;
  
  case '3':
  switch (index)
    {
    case 1:
      mySerial.write(threeone, sizeof(threeone));
      break;
    case 2:
      mySerial.write(threetwo, sizeof(threetwo));
      break;
    case 3:
      mySerial.write(threethree, sizeof(threethree));
      break;
    case 5:
      mySerial.write(threefive, sizeof(threefive));
      break;
    case 6:
      mySerial.write(threesix, sizeof(threesix));
      break;
    }
    break;
  
  case '4':
  switch (index)
    {
    case 1:
      mySerial.write(fourone, sizeof(fourone));
      break;
    case 2:
      mySerial.write(fourtwo, sizeof(fourtwo));
      break;
    case 3:
      mySerial.write(fourthree, sizeof(fourthree));
      break;
    case 5:
      mySerial.write(fourfive, sizeof(fourfive));
      break;
    case 6:
      mySerial.write(foursix, sizeof(foursix));
      break;
    }
    break;
  
  case '5':
  switch (index)
    {
    case 1:
      mySerial.write(fiveone, sizeof(fiveone));
      break;
    case 2:
      mySerial.write(fivetwo, sizeof(fivetwo));
      break;
    case 3:
      mySerial.write(fivethree, sizeof(fivethree));
      break;
    case 5:
      mySerial.write(fivefive, sizeof(fivefive));
      break;
    case 6:
      mySerial.write(fivesix, sizeof(fivesix));
      break;
    }
    break;
  
  case '6':
  switch (index)
    {
    case 1:
      mySerial.write(sixone, sizeof(sixone));
      break;
    case 2:
      mySerial.write(sixtwo, sizeof(sixtwo));
      break;
    case 3:
      mySerial.write(sixthree, sizeof(sixthree));
      break;
    case 5:
      mySerial.write(sixfive, sizeof(sixfive));
      break;
    case 6:
      mySerial.write(sixsix, sizeof(sixsix));
      break;
    }
    break;
  
  case '7':
  switch (index)
    {
    case 1:
      mySerial.write(sevenone, sizeof(sevenone));
      break;
    case 2:
      mySerial.write(seventwo, sizeof(seventwo));
      break;
    case 3:
      mySerial.write(seventhree, sizeof(seventhree));
      break;
    case 5:
      mySerial.write(sevenfive, sizeof(sevenfive));
      break;
    case 6:
      mySerial.write(sevensix, sizeof(sevensix));
      break;
    }
    break;
  
  case '8':
  switch (index)
    {
    case 1:
      mySerial.write(eightone, sizeof(eightone));
      break;
    case 2:
      mySerial.write(eighttwo, sizeof(eighttwo));
      break;
    case 3:
      mySerial.write(eightthree, sizeof(eightthree));
      break;
    case 5:
      mySerial.write(eightfive, sizeof(eightfive));
      break;
    case 6:
      mySerial.write(eightsix, sizeof(eightsix));
      break;
    }
    break;
  
  case '9':
  switch (index)
    {
    case 1:
      mySerial.write(nineone, sizeof(nineone));
      break;
    case 2:
      mySerial.write(ninetwo, sizeof(ninetwo));
      break;
    case 3:
      mySerial.write(ninethree, sizeof(ninethree));
      break;
    case 5:
      mySerial.write(ninefive, sizeof(ninefive));
      break;
    case 6:
      mySerial.write(ninesix, sizeof(ninesix));
      break;
    }
    break;        
  }
}

About Ashraf Nabil

Leave a Reply