Tagged: 

Viewing 1 reply thread
  • Author
    Posts
    • bfosterbfoster
      Participant
      @bfoster
      Post count: 1

      Hello,

      I have the STW1043WT-01 connected through the STONE USB to UART converter to the RX/TX on the Arduino Uno.   Power supply connected on the USB to UART converter board is the IET power supply model SO18BU1200150 (output 12V @ 1500mA)

      I have a HMI button that sends data to the Arduino just fine (I get back good raw HEX data).  But when sending any JSON commands I get nothing back on the Arduino IDE’s Serial Monitor. In this case I’m sending the sys_hello command when I press the hardwired pushbutton. Arduino IDE's Serial Monitor Results

      My Test Setup

      This is my code:

      #include “stone.h”
      int inputChar;
      int led1 = 13; // pin 13 has LED connected
      int button1 = 2;  // pin 2 has a pushbutton connected
      int button1_Val = 0;
      int radioButton_Set = 0;
      int radioButton_Reset = 0;

      void setup()
      {
      pinMode(led1, OUTPUT);  // initalize pin as output
      pinMode(button1, INPUT);  // initalize pin as input
      digitalWrite(led1, LOW);  // set LED off
      Serial.begin(115200);
      }

      void loop()
      {
      serial_receive();

      /*if (Serial.available() > 0){
      inputChar = Serial.read();
      if (inputChar == 0x01){
      digitalWrite(led1, HIGH);
      }
      if (inputChar == 0x00){
      digitalWrite(led1, LOW);
      }
      }*/

      button1_Val = digitalRead(button1);

      if (button1_Val == 1 && radioButton_Set == 0){
      //Serial.println(“ST<{\”cmd_code\”:\”get_checked\”,\”type\”:\”radio_button\”,\”widget\”:\”radio_button1\}>ET”);
      //Serial.println(“ST<{\”cmd_code\”:\”set_text\”,\”type\”:\”label\”,\”widget\”:\”label1\”,\”text\”:\”\hello\”}>ET”);
      Serial.println(“ST<{\”cmd_code\”:\”sys_hello\”,\”type\”:\”system\”}>ET”);
      radioButton_Set = 1;
      delay(1000);
      }

      if (button1_Val == 0 && radioButton_Set == 1){
      //Serial.println(“ST<{\”cmd_code\”:\”set_value\”,\”type\”:\”radio_button\”,\”widget\”:\”radio_button1\”,\”value\”:false}>ET”);
      radioButton_Set = 0;
      }

      }

      Also see my Stone-designer file.

      Please advise of any suggestions to help resolve the problem.

      Thanks

       

    • WuChaoWuChao
      Keymaster
      @wuchao
      Post count: 38

      Hi dear,

      If you want to send json in Arduino, you need to follow the standard of Arduino’s json library. You can try it again and let me know on email and wsap chao@stone-hmi.com / WSAPP +8613260055123 to facilitate our quick communication.

      You can also forward my contact to your purchase team, I can offer a better price. More than appreciate!

      Look forward your reply and have a good day!

      Best Regards,

      Chao

      Stone Tech

Viewing 1 reply thread
  • You must be logged in to reply to this topic.