How to simultaneously publish the data to multi fields of thingspeak channel from a raspberry pi via code generation deployment using MATLAB code(not via Simulink) .
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
prechanon kumkratug
el 18 de En. de 2020
Respondida: Christopher Stapels
el 22 de En. de 2020
The method to publish one field(field1) to think speak is given by the John Anderson
% raspberry pi object
r = raspi();
% log file
fid = fopen( 'logFile.log', 'w' );
% write random number to thingSpeak channel
v = rand;
commandStr = [ 'sudo curl -s "https://api.thingspeak.com/update.json?api_key=<your api key here>&field1=' sprintf( '%f', v ) '"' ];
result = system( r, commandStr );
% log command
fprintf( fid, '%s \n', commandStr );
% log result
fprintf( fid, '%s \n', result );
% close log
fclose( fid );
How to modify it to simultaneously publish the 2 data to 2 fields (field1 and field2) of thingspeak channel .
0 comentarios
Respuestas (1)
Christopher Stapels
el 22 de En. de 2020
Have a look at the Write Data page. You can append &fieldX=value to add additional fields to an update.
0 comentarios
Comunidades de usuarios
Más respuestas en ThingSpeak Community
Ver también
Categorías
Más información sobre Run on Target Hardware en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!