Ashraf Nabil
Published

Real-Time Bitcoin Price Monitor Using Arduino and 1Sheeld

Build a real-time Bitcoin price monitor using an LED matrix, Arduino and 1Sheeld as Internet shield.

Work in progress1,495
Real-Time Bitcoin Price Monitor Using Arduino and 1Sheeld

Things used in this project

Hardware components

Arduno UNO
×1
1Sheeld
1Sheeld
×1
RS-232 to UART converter
×1
LED Matrix
×1

Story

Read more

Code

Untitled

C/C++
#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);
}

Untitled

C/C++
#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;        
  }
}

Credits

Ashraf Nabil

Ashraf Nabil

8 projects • 86 followers

Comments