Get information from the Internet

Maybe you wore out your welcome at the web site?

1 Like

Maybe the website is blocking the api when there are a lot of requests.

1 Like

Can you please check, maybe there is an error somewhere.
test.aia (22.0 KB)

The site works very well until then if you do not send it via Bluetooth separately.
I think there is a mistake in dividing the letters and sending one by one

Why are you sending the characters one by one and not all together?

1 Like

Then I want to display this on the display. I think that if it is sent in full, then it is impossible to display it.

I think there shouldn't be a problem. Displays generally accept string values. What display? Data received in arduino can also be split in C++ code.

The code looks like this:

#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#define TFT_DC    D1
#define TFT_RST   D2
#define TFT_CS    D8
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);

#include <BluetoothSerial.h>
BluetoothSerial SerialBT;

void setup() {
  Serial.begin(9600);
  tft.init(240, 240, SPI_MODE2);
  tft.setRotation(2);
  tft.fillScreen(ST77XX_BLACK);
}

void loop() {
  if (SerialBT.available()) {  // check if data is available
    String receivedData = SerialBT.readString();
    if (receivedData == "1") {
      tft.print("1");
    }
    if (receivedData == "2") {
      tft.print("2");
    }
    if (receivedData == "3") {
      tft.print("3");
    }
    if (receivedData == "4") {
      tft.print("4");
    }
    if (receivedData == "5") {
      tft.print("5");
    }
    if (receivedData == "6") {
      tft.print("6");
    }
    if (receivedData == "7") {
      tft.print("7");
    }
    if (receivedData == "8") {
      tft.print("8");
    }
    if (receivedData == "9") {
      tft.print("9");
    }
    if (receivedData == "0") {
      tft.print("0");
    }

  }
}

I have other characters in the application that sends. I'm afraid that arduino also displays these characters on the screen

Why not like this:

void loop() {
  if (SerialBT.available()) {  // check if data is available
    String receivedData = SerialBT.readString();
      tft.print(receivedData);
    }

You can use
SerialBT.flush();
to flush the serial port buffer of redundant data.

1 Like

I considered this option in my mind.
It's just that the application sometimes sends characters, in the code that you sent, it displays the entire value on the screen.

Thank you very much for your hard work and patience!
For helping me for 3 days. I will definitely try it

Please tell me what needs to be done to remove seconds from the time.
So that Bluetooth sends hours and minutes

The app cannot send anything by itself. You have to have control over everything, read every byte sent from the app in the arduino. If you see different characters on the display, it means that all communication is poorly thought out.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.