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) .
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Christopher Stapels
2020년 1월 22일
Have a look at the Write Data page. You can append &fieldX=value to add additional fields to an update.
댓글 수: 0
커뮤니티
더 많은 답변 보기: ThingSpeak 커뮤니티
참고 항목
카테고리
Help Center 및 File Exchange에서 Write Data to Channel에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!