prechanon kumkratug in MATLAB Answers
上次活动时间: 2020-1-22

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 ); https://www.mathworks.com/matlabcentral/answers/467879-how-do-i-write-to-a-thingspeak-channel-from-a-raspberry-pi-via-code-deployed-using-the-matlab-coder How to modify it to simultaneously publish the 2 data to 2 fields (field1 and field2) of thingspeak channel .

关于 ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.