Author Topic: Where to publish array in code mqtt  (Read 485 times)

0 Members and 1 Guest are viewing this topic.

Offline King123Topic starter

  • Contributor
  • Posts: 18
  • Country: in
Where to publish array in code mqtt
« on: September 02, 2022, 06:29:32 pm »

In this sketch Where I need to write mqtt line  client.publish("Receievd",  input );

Code: [Select]

//Arduino Uno
int count = 0;                                          // count = 0
char input[11];                                         // character array   
void setup()

Serial.begin(9600);               // begin serial port with baud rate 9600bps
}
void loop()
{     
if(Serial.available())
{
count = 0; 
while(Serial.available() && count < 12) // Read 12 characters and store them in input array     
{       
input[count] = Serial.read();
count++;
delay(5);     
}     
Serial.print(input);                             // Print RFID tag number       Serial.print("\n");     
if ( strcmp(input,"0A006FBE33E9") == 0)     
{       
Serial.print("Tag One");       
Serial.print("\n");     
}     
     
Serial.print("\n");      }
}
}
what would be correct line  client.publish("Receievd",  input ) or  client.publish("Receievd",  input[count] );

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf