/*
Sketch generated by the Arduino IoT Cloud Thing "Temp and Hum for farming"
https://create.arduino.cc/cloud/things/520b6b3c-6890-4e9a-a7b4-d0706cb7b9d7
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
float humidity;
float temperature;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
#include <Arduino_MKRIoTCarrier.h>
MKRIoTCarrier carrier;
void setup()
{
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
//Wait to get cloud connection to init the carrier
while (ArduinoCloud.connected() != 1)
{
ArduinoCloud.update();
delay(500);
}
delay(500);
CARRIER_CASE = false;
carrier.begin();
}
void loop()
{
ArduinoCloud.update();
// Your code here
temperature = carrier.Env.readTemperature();
humidity = carrier.Env.readHumidity();
Serial.print(temperature);
Serial.print(",");
Serial.println(humidity);
delay(1000);
}
The simplest way to upload code formatted and laid out correctly is to use Auto Format in the IDE then right click and select "Copy for forum" and paste the clipboard in a post here with the code tags already added for you
Alternatively copy the code from the IDE with the normal copy command, paste it here, select all of it and click the </> icon above the edit window or paste the code here and type [code] before it and [/code] after it or paste the code here and type 3 backticks before it and 3 backticks after it
All of this is described in the linke that I posted. Did you read any of it ?
not aware that In this toolbox would something different I could click </>
instead that's why you saw in my post that you edited it had </> at the start and end of the code
thinking it was going to do the same thing.
formating the code new to me had no idea what that was about there no examples visually that help me understand what you wanted that's why I buy courses to see visually
skipped the part about writing the post cause it wasn't relevant cause it wasn't what you wanted. instead I focused on what you said "read and copy your code the more likely it is that you will get help" Thats what I wanted to move forward to go back to course
This is what I did
and problems I ran into this was nothing what I expected....
1.changed USB 3 times thought maybe it was broken
2. The port stopped working it was working since Wednesday so I went to my brothers last night
3. we downloaded the file that allows MKR 1010 to work for my mac and his mac air
4. This was over my head on this we went on the Terminal type "ls -lah" to see if it would connect
5. it wasn't connecting to the port then we ended up finding out it was being blocked
6. it was my Malware protector we unstalled it
7. so we thought maybe it's mac computers that are the problem since it wasn't connecting to the port still.
8. we went to my brother PC did all the same steps getting file to run MRK 1010 we were starting to think it was the hardware...
9. at this point we wanted go to factory setting finding out pushing the reset button twice really quick will do that. it was blinking sooooo wtf
10. At this point my brothers goes what were the steps did you do that got you to this point you would never guess this.
11. When configuring the wifi in the course it tells you can name it whatever you want and password this isn't case... it was creating a loop. and we made it's own server on the wifi
to gain access to it... then it finally connected but still wouldn't connect to the port. ( I may be explaining this part wrong about wifi sorry inadvance)
12. then we went into it to change it instead of darthdingus my wifi at home ( which I forgot we got a new modem)
13. The problem why I was getting the error was you have to make sure that the name and password is exactly the same as your modem where you receive your internet. FML! I would of never figure this out the course sets you up for failure.
so if you run into this problem delete all the work on IoT cloud and just redo it and add the code
it will connect and you will be able to read the temperature and Humidity and MAKE SURE YOU HAVE THE "Network Name (SSID): exactly as your modem so it connects.
Thank you UKHel for teaching me how to put code in toolbox correctly.
Sorry if I was frustrating I'm still new to this. I learned a lot from this and will make sure to explain every step that got me to the errors