0

I am working on a project which displays time of School bells for a school, I have got 5*TM1637 Display Tubes which displays 5 Periods/Classes start timings.I can set digits of each TM1637 using the code (attached with this question) which i made to display time. But the problem is : The time of each period/class changes regularly, some periods will be little longer from yesterday, some shorter and vice versa.

To overcome this problem i adding HC-05 Bluetooth module on Hardware Serial2 , on the other hand i have also developed an app using MIT app inventor which inputs in a form of characters and sends it via bluetooth to HC-05.

The bytes will be in this format : english09:30 ,science11:00 etc, The format includes the period/class name with the time.(is there any other better way around to format and send these values, Please let me know)

I want to take this information and change the displaying time on TM1607 Modules respectively.

edit : I want my code to understand the received byte and set the time to Specified TM1607 associated to it. like when it receive "english09:30" it should change the digits on TM1607 in void english();

Here is my code :

#include "TM1637.h"


#define CLK1 2
#define DIO1 3

#define CLK2 4
#define DIO2 5

#define CLK3 6
#define DIO3 7

#define CLK4 8
#define DIO4 9

#define CLK5 10
#define DIO5 11

TM1637 Display1 (CLK1, DIO1);

TM1637 Display2 (CLK2, DIO2);

TM1637 Display3 (CLK3, DIO3);

TM1637 Display4 (CLK4, DIO4);

TM1637 Display5 (CLK5, DIO5);


void setup ()
{
  Display1.set ();
  Display1.init ();

  Display2.set();
  Display2.init();

  Display3.set();
  Display3.init();

  Display4.set();
  Display4.init();

  Display5.set();
  Display5.init();
  Serial.begin(9600);
  Serial2.begin(9600);
}

void loop ()
{
  while (Serial2.available())
    Serial.write( Serial2.read() );
  english();
  biology();
  social();
  math();
  chemistry();
}

void english ()
{
  int8_t Digits [] = {1, 2 , 3 , 4 };
  Display1.display (Digits);
  Display1.point(POINT_ON);
}

void biology ()
{
  int8_t Digits [] = {1, 2 , 3 , 4 };
  Display2.display (Digits);
  Display2.point(POINT_ON);
}


void math ()
{
  int8_t Digits [] = {1, 2 , 3 , 4 };
  Display2.display (Digits);
  Display2.point(POINT_ON);
}


void social ()
{
  int8_t Digits [] = {1, 2 , 3 , 4 };
  Display2.display (Digits);
  Display2.point(POINT_ON);
}


void chemistry ()
{
  int8_t Digits [] = {1, 2 , 3 , 7 };
  Display2.display (Digits);
  Display2.point(POINT_ON);
}

EDIT:

My question is how to parse the incoming string ("english09:10") the get the class name and the starting hour.

  • Are you asking how to add the HC-05 to your sketch? – user31481 Nov 7 '17 at 14:28
  • NO,i want to take bytes from HC-05 which will be " english09:30 " in this format. I want my code to understand the received byte and set the time to specified TM1607 associated to it. like when it receive "english09:30" it should change the digits on TM1607 in void english() – Mudassir Hussain Nov 7 '17 at 14:33
  • So your problem is how to parse the answer ("english09:30") and recover the class and and time as separate values? – user31481 Nov 7 '17 at 14:35
  • Yes, that's right! – Mudassir Hussain Nov 7 '17 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.