% Write command to the ThingSpeak server. writeApiKey = 'UQ6TMK7Q95VY6DGH'; channelID = 1057217; thingSpeakURL = 'http://api.thingspeak.com'; thingSpeakWriteURL = [thingSpeakURL '/update']; fieldName = 'field1'; TurnON=1; TurnOFF=0; % Turns LED on: fieldValue = TurnOFF; response=webwrite(thingSpeakWriteURL,'api_key',writeApiKey,fieldName,fieldValue);