hi
im very new to arduino and code writing and wondered if anyone could help.
ive been trying to connect my mkr1010 to wifi then transmit the temperature from the mkr therm via bylink to my phone.
i can make all individual components work (wifi connection, temperature reading and connection to bylnk) however im straggling to get all 3 sketches to work together.
im sure im just missing a simple step and wondered if anyone could offer advise.
#include <WiFiNINA.h>
#include "arduino_secrets.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS; // the Wifi radio's status
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial);
// attempt to connect to Wifi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to network: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network:
status = WiFi.begin(ssid,pass);
// wait 10 seconds for connction:
delay(10000);
}
// you're connected now, so print out the data:
Serial.println("You're connected to the network");
Serial.println("----------------------------------------");
printData();
Serial.println("----------------------------------------");
}
void loop() {
// check the network connection once every 10 seconds:
delay(10000);
printData();
Serial.println("----------------------------------------");
}
void printData() {
Serial.println("Board Information:");
// print your board's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
Serial.println();
Serial.println("Network Information:");
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.println(rssi);
byte encryption = WiFi.encryptionType();
Serial.print("Encryption Type:");
Serial.println(encryption, HEX);
Serial.println();
}
#include <Arduino_MKRTHERM.h>
void setup() {
Serial.begin(9600);
while (!Serial);
if (!THERM.begin()) {
Serial.println("Failed to initialize MKR THERM shield!");
while (1);
}
}
void loop() {
Serial.print("Reference temperature ");
Serial.print(THERM.readReferenceTemperature());
Serial.println(" °C");
Serial.print("Temperature ");
Serial.print(THERM.readTemperature());
Serial.println(" °C");
Serial.println();
delay(10000);
}