GARAM LEE in MATLAB Answers
Última actividad el 10 de Nov. de 2022

Good afternoon. I want to send mpu6050 data to thingspeak every second. However, data is only sent once now. How can I keep sending data? (When I searched for it, there is a saying that the data transfer limit of thingspeak is 15 seconds, so is it possible to transfer data one by one in up to 15 seconds?) And currently, the board and laptop are connected by a usb cable for uploading the code, so can I still send data even if I remove the usb cable and connect the external battery after uploading? Hardware : mkr1000, mpu6050 #include <SPI.h> #include <WiFi101.h> #include <Wire.h> #include <I2Cdev.h> #include <WiFiClient.h> #include "MPU6050.h" #include "ThingSpeak.h" // always include thingspeak header file after other header files and custom macros char ssid[] = "abc-2.4G"; // your network SSID (name) char pass[] = "abcdefgh"; // your network password // Initialize the Wifi client library WiFiClient client; unsigned long myChannelNumber = num; const char * myWriteAPIKey = "key tiped"; MPU6050 accel1; int16_t ax1, ay1, az1; int16_t gx1, gy1, gz1; unsigned long lastTime = 0; unsigned long timerDelay = 1000; // sending every second void setup() { Serial.begin(115200); // Initialize serial Wire.begin ( ); accel1.initialize(); delay(10); WiFi.begin(ssid, pass); // Connect to WPA/WPA2 network. ThingSpeak.begin(client); // Initialize ThingSpeak } void loop() { if (millis() - lastTime >= timerDelay) { accel1.getMotion6(&ax1, &ay1, &az1, &gx1, &gy1, &gz1); //acceleration full-scale range between +-2 g (16,384LSB/g) float accX = ((float)ax1) / 16384.0; float accY = ((float)ay1) / 16384.0; float accZ = ((float)az1) / 16384.0; // set the fields with the values ThingSpeak.setField(1, accX); ThingSpeak.setField(2, accY); ThingSpeak.setField(3, accZ); ThingSpeak.setField(4, gx1); ThingSpeak.setField(5, gy1); ThingSpeak.setField(6, gz1); ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey); } lastTime = millis(); // Update the last update time }
N/A in MATLAB Answers
Última actividad el 7 de Jun. de 2021

I am using the standard program WriteSingleField from the Thingspeak library to send a number between 0 and 99 to one of he fields in my channel. Every 20 seconds the field is updated in the Arduino program. But after two updates I get an HTTP error -301 and the channel is stops updating... I tried several things (changing my write api key, using a longer delay, ) but cannot find a suolution. My Arduino MKR1000 uses the WiFi101 library and this is also the latest version 0.16.1. I have not changed anything in my WiFi router. Who knows a solution?
Mfar in MATLAB Answers
Última actividad el 13 de Nov. de 2018

Dear all, I am trying to use the library block of the ThingSpeak write/read in a very simple model to write data on a ThingSpeak channel. Every time, I add the block from the library, I receive the following error, please check the attached photo. ThingSpeak Write block is not supported on Arduino MKR1000. Choose a different supported Arduino board. Is that an error or a fact? I think the ThingSpeak blocks doesn't say anything about the supported devices.

Acerca de 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.