<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>JustEncaseBLOG#5TestingPart2</title><link>/members-area/b/blog/posts/justencaseblog-5testingpart2</link><description>TEST# 2 - Measure the Environment within the Waterproof Enclosure 1554H2GYCL 



Description

For this Test, I purchased two Grove Sensors from Seeed and used two of sensors from the supplied Grove starter Kit.
I also purchased the Arduino MKR...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: JustEncaseBLOG#5TestingPart2</title><link>https://community.element14.com/members-area/b/blog/posts/justencaseblog-5testingpart2</link><pubDate>Mon, 21 Feb 2022 19:17:43 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f9340056-655c-4667-b8d0-bc4ed35db64f</guid><dc:creator>skruglewicz</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;CODE- MKR_LoRa_Sender_E2.ino&lt;/p&gt;
&lt;p&gt;CODE WAS MOVED HERE FROM THIS BLOG&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:4a2a0352-88c7-467f-8f01-40f88de7ea64:type=text&amp;text=%2F%2A%20%0D%0A%20%20Sketch%20generated%20by%20the%20Arduino%20IoT%20Cloud%20Thing%20%221554H2GYCL%20%22%0D%0A%20%20https%3A%2F%2Fcreate.arduino.cc%2Fcloud%2Fthings%2Ff6a8d66c-2702-45e7-b93a-a2d41f9bedb8%20%0D%0A%0D%0A%20%20Arduino%20IoT%20Cloud%20Variables%20description%0D%0A%0D%0A%20%20The%20following%20variables%20are%20automatically%20generated%20and%20updated%20when%20changes%20are%20made%20to%20the%20Thing%0D%0A%0D%0A%20%20String%20water%3B%0D%0A%20%20float%20dust%3B%0D%0A%20%20float%20temp%3B%0D%0A%20%20int%20waterInt%3B%0D%0A%0D%0A%20%20Variables%20which%20are%20marked%20as%20READ%2FWRITE%20in%20the%20Cloud%20Thing%20will%20also%20have%20functions%0D%0A%20%20which%20are%20called%20when%20their%20values%20are%20changed%20from%20the%20Dashboard.%0D%0A%20%20These%20functions%20are%20generated%20with%20the%20Thing%20and%20added%20at%20the%20end%20of%20this%20sketch.%0D%0A%2A%2F%0D%0A%0D%0A%23include%20%22thingProperties.h%22%0D%0AString%20inputString%20%3D%20%22%22%3B%20%20%20%20%20%20%20%20%20%2F%2F%20a%20String%20to%20hold%20incoming%20data%0D%0Abool%20stringComplete%20%3D%20false%3B%20%20%2F%2F%20whether%20the%20string%20is%20complete%0D%0A%0D%0Afloat%20retFloat%28String%20stringOne%29%20%7B%0D%0A%20%20%2F%2F%20Given%20a%20tuple%20pair%20in%20the%20form%20varname%3Avalue%20ex.%20inTemp%3A1.1%0D%0A%20%20%2F%2F%20return%20a%20float%20value%20to%20the%20right%20of%20the%20colon%20character%0D%0A%2F%2FSerial.println%28stringOne%29%3B%0D%0Aint%20firstClosingBracket%20%3D%20stringOne.indexOf%28%27%3A%27%29%3B%0D%0AString%20value%20%3D%20String%28stringOne.substring%28firstClosingBracket%2B1%29%29%3B%0D%0A%2F%2FSerial.println%28value%29%3B%0D%0Afloat%20val%20%20%3D%20value.toFloat%28%29%3B%0D%0A%20%20%20return%20val%3B%0D%0A%7D%0D%0A%0D%0AString%20retString%28String%20stringOne%29%20%7B%0D%0A%20%20%2F%2F%20Given%20a%20tuple%20pair%20in%20the%20form%20varname%3Avalue%20ex.%20inTemp%3A1.1%0D%0A%20%20%2F%2F%20return%20a%20int%20%20value%20to%20the%20right%20of%20the%20colon%20character%0D%0A%2F%2FSerial.println%28stringOne%29%3B%0D%0Aint%20firstClosingBracket%20%3D%20stringOne.indexOf%28%27%3A%27%29%3B%0D%0AString%20value%20%3D%20stringOne.substring%28firstClosingBracket%2B1%29%3B%0D%0A%2F%2FSerial.println%28value%29%3B%0D%0A%2F%2Ffloat%20val%20%20%3D%20value.toInt%28%29%3B%0D%0A%20%20%20return%20value%3B%0D%0A%7D%0D%0A%0D%0AString%20getType%28String%20stringOne%29%7B%0D%0A%20%20int%20colon%20%3D%20stringOne.indexOf%28%27%3A%27%29%3B%0D%0A%20%20String%20value%20%3D%20stringOne.substring%280%2Ccolon%29%3B%0D%0A%20%20%2F%2FSerial.println%28value%29%3B%0D%0A%20%20%20%20%20return%20value%3B%20%20%0D%0A%7D%0D%0A%0D%0Avoid%20setup%28%29%20%7B%0D%0A%20%20%2F%2F%20Initialize%20serial%20and%20wait%20for%20port%20to%20open%3A%0D%0A%20%20Serial.begin%289600%29%3B%0D%0A%20%20Serial1.begin%289600%29%3B%0D%0A%20%20%0D%0A%20%20%2F%2F%20This%20delay%20gives%20the%20chance%20to%20wait%20for%20a%20Serial%20Monitor%20without%20blocking%20if%20none%20is%20found%0D%0A%20%20delay%281500%29%3B%20%0D%0A%0D%0A%20%20%2F%2F%20Defined%20in%20thingProperties.h%0D%0A%20%20initProperties%28%29%3B%0D%0A%0D%0A%20%20%2F%2F%20Connect%20to%20Arduino%20IoT%20Cloud%0D%0A%20%20ArduinoCloud.begin%28ArduinoIoTPreferredConnection%29%3B%0D%0A%20%20%2F%2Fdelay%283000%29%3B%0D%0A%20%20%0D%0A%20%20%2F%2A%0D%0A%20%20%20%20%20The%20following%20function%20allows%20you%20to%20obtain%20more%20information%0D%0A%20%20%20%20%20related%20to%20the%20state%20of%20network%20and%20IoT%20Cloud%20connection%20and%20errors%0D%0A%20%20%20%20%20the%20higher%20number%20the%20more%20granular%20information%20you%E2%80%99ll%20get.%0D%0A%20%20%20%20%20The%20default%20is%200%20%28only%20errors%29.%0D%0A%20%20%20%20%20Maximum%20is%204%0D%0A%20%2A%2F%0D%0A%20%20setDebugMessageLevel%282%29%3B%0D%0A%20%20ArduinoCloud.printDebugInfo%28%29%3B%0D%0A%7D%0D%0A%0D%0A%0D%0Avoid%20loop%28%29%20%7B%0D%0A%20%20ArduinoCloud.update%28%29%3B%0D%0A%20%20%2F%2F%20Your%20code%20here%20%0D%0A%20%20%0D%0A%20%20%2F%2F%20use%20the%20string%20when%20a%20newline%20arrives%3A%0D%0A%20%20if%20%28stringComplete%29%20%7B%0D%0A%20%20%20%20Serial.print%28%22received%20on%20RX%20PIN%3A%22%29%3B%0D%0A%20%20%20%20Serial.print%28inputString%29%3B%0D%0A%0D%0A%20%20%20%20%0D%0A%20%20%20%20%2F%2FUSE%20THE%20InputString%20HERE%0D%0A%20%20%20%20%2F%2F%20get%20the%20type%20of%20var%0D%0A%20%20%20%20String%20type%20%3D%20getType%28inputString%29%3B%0D%0A%20%20%20%20%0D%0A%20%20%20%20if%28type%20%3D%3D%20%22Temp%22%29%7B%0D%0A%20%20%20%20%20%20temp%20%3D%20retFloat%28inputString%29%3B%20%0D%0A%20%20%20%20%20%20Serial.print%28%22Sending%20value%20%3D%20%22%29%3B%0D%0A%20%20%20%20%20%20Serial.println%28temp%29%3B%0D%0A%20%20%20%20%7D%0D%0A%20%20%20%20%0D%0A%20%20%20%20if%28type%20%3D%3D%20%22Dust%22%29%7B%0D%0A%20%20%20%20%20%20dust%20%3D%20retFloat%28inputString%29%3B%20%0D%0A%20%20%20%20%20%20Serial.print%28%22Sending%20value%20%3D%20%22%29%3B%0D%0A%20%20%20%20%20%20Serial.println%28dust%29%3B%0D%0A%20%20%20%20%7D%0D%0A%20%20%20%20%0D%0A%20%20%20%20if%28type%20%3D%3D%20%22Water%22%29%7B%0D%0A%20%20%20%20%20%20water%20%3D%20retString%28inputString%29%3B%20%0D%0A%20%20%20%20%20%20if%20%28water%20%3D%3D%20%22WET%5Cn%22%29%7B%0D%0A%20%20%20%20%20%20%20%20waterInt%20%3D%200%3B%0D%0A%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20if%20%28water%20%3D%3D%20%22DRY%5Cn%22%29%7B%0D%0A%20%20%20%20%20%20%20%20waterInt%20%3D%201%3B%0D%0A%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20Serial.print%28%22Sending%20value%20%3D%20%22%29%3B%0D%0A%20%20%20%20%20%20Serial.print%28water%29%3B%0D%0A%20%20%20%20%20%20Serial.println%28waterInt%29%3B%0D%0A%20%20%20%20%7D%20%20%0D%0A%20%20%20%20%0D%0A%20%20%20%20inputString%20%3D%20%22%22%3B%0D%0A%20%20%20%20stringComplete%20%3D%20false%3B%0D%0A%20%20%7D%0D%0A%20%20%0D%0A%20%20%2F%2FAt%20the%20very%20end%20of%20the%20loop%20check%20for%20serial%20data%0D%0A%20%20serialEvent%28%29%3B%0D%0A%20%20%0D%0A%7D%0D%0A%0D%0A%2F%2A%0D%0A%20%20SerialEvent%20occurs%20whenever%20a%20new%20data%20comes%20in%20the%20hardware%20serial%20RX.%20This%0D%0A%20%20routine%20is%20run%20between%20each%20time%20loop%28%29%20runs%2C%20so%20using%20delay%20inside%20loop%20can%0D%0A%20%20delay%20response.%20Multiple%20bytes%20of%20data%20may%20be%20available.%0D%0A%2A%2F%0D%0Avoid%20serialEvent%28%29%20%7B%0D%0A%20%20while%20%28Serial1.available%28%29%29%20%7B%0D%0A%20%20%20%20%2F%2F%20get%20the%20new%20byte%3A%0D%0A%20%20%20%20char%20inChar%20%3D%20%28char%29Serial1.read%28%29%3B%0D%0A%20%20%20%20%2F%2F%20add%20it%20to%20the%20inputString%3A%0D%0A%20%20%20%20%0D%0A%20%20%20%20inputString%20%2B%3D%20inChar%3B%0D%0A%20%20%20%20%2F%2F%20if%20the%20incoming%20character%20is%20a%20newline%2C%20set%20a%20flag%20so%20the%20main%20loop%20can%0D%0A%20%20%20%20%2F%2F%20do%20something%20about%20it%3A%0D%0A%20%20%20%20if%20%28inChar%20%3D%3D%20%27%5Cn%27%29%20%7B%0D%0A%20%20%20%20%20%20stringComplete%20%3D%20true%3B%0D%0A%20%20%20%20%7D%0D%0A%20%20%7D%0D%0A%7D%0D%0A%2F%2A%0D%0A%20%20Since%20Temp%20is%20READ_WRITE%20variable%2C%20onTempChange%28%29%20is%0D%0A%20%20executed%20every%20time%20a%20new%20value%20is%20received%20from%20IoT%20Cloud.%0D%0A%2A%2F%0D%0Avoid%20onTempChange%28%29%20%20%7B%0D%0A%20%20%2F%2F%20Add%20your%20code%20here%20to%20act%20upon%20Temp%20change%0D%0A%7D%0D%0A%0D%0A%2F%2A%0D%0A%20%20Since%20Water%20is%20READ_WRITE%20variable%2C%20onWaterChange%28%29%20is%0D%0A%20%20executed%20every%20time%20a%20new%20value%20is%20received%20from%20IoT%20Cloud.%0D%0A%2A%2F%0D%0Avoid%20onWaterChange%28%29%20%20%7B%0D%0A%20%20%2F%2F%20Add%20your%20code%20here%20to%20act%20upon%20Water%20change%0D%0A%7D%0D%0A%0D%0A%2F%2A%0D%0A%20%20Since%20WaterInt%20is%20READ_WRITE%20variable%2C%20onWaterIntChange%28%29%20is%0D%0A%20%20executed%20every%20time%20a%20new%20value%20is%20received%20from%20IoT%20Cloud.%0D%0A%2A%2F%0D%0Avoid%20onWaterIntChange%28%29%20%20%7B%0D%0A%20%20%2F%2F%20Add%20your%20code%20here%20to%20act%20upon%20WaterInt%20change%0D%0A%7D%0D%0A%0D%0A%2F%2A%0D%0A%20%20Since%20Dust%20is%20READ_WRITE%20variable%2C%20onDustChange%28%29%20is%0D%0A%20%20executed%20every%20time%20a%20new%20value%20is%20received%20from%20IoT%20Cloud.%0D%0A%2A%2F%0D%0Avoid%20onDustChange%28%29%20%20%7B%0D%0A%20%20%2F%2F%20Add%20your%20code%20here%20to%20act%20upon%20Dust%20change%0D%0A%7D]&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;&lt;/ul&gt;&lt;img src="https://community.element14.com/aggbug?PostID=23099&amp;AppID=75&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: JustEncaseBLOG#5TestingPart2</title><link>https://community.element14.com/members-area/b/blog/posts/justencaseblog-5testingpart2</link><pubDate>Mon, 21 Feb 2022 19:13:25 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f9340056-655c-4667-b8d0-bc4ed35db64f</guid><dc:creator>skruglewicz</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;CODE- MKR_LoRa_Sender_E2.ino&lt;/p&gt;
&lt;p&gt;CODE HAS MOVED TO COMMENTS BELOW&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:c12dab1e-b449-4197-ae5f-7e5dc8824b18:type=c_cpp&amp;text=%0D%0A%2F%2A%0D%0AMKR_LoRa_SENDER_InTemp%0D%0AThis%20sketch%20will%20get%20the%20temprture%20from%20a%20DS18B20%20Temperature%20Sensor%20attached%20to%20the%20MKR%20WAN%201300%20%0D%0AEach%20time%20the%20loop%20runs%2C%20we%20will%20send%20a%20%22packet%22%20containing%20the%20message%20%22InTemp%3A%3Ctemp%3E%0D%0Athe%20value%20of%20%3Ctemp%3E%20will%20contain%20the%20current%20tempreture%20from%20the%20sensor%0D%0AThe%20packet%20will%20be%20sent%20%0D%0A%0D%0A1-20-2020%20Added%20OLED%20Adafruit_SSD1306%20support.%0D%0A%0D%0A%2A%2F%0D%0A%0D%0A%2F%2F%20MKRWAN%20-%20Version%3A%201.0.15%0D%0A%23include%20%3CMKRWAN.h%3E%0D%0A%0D%0A%23include%20%3CSPI.h%3E%0D%0A%23include%20%3CLoRa.h%3E%0D%0A%23include%20%3CWire.h%3E%0D%0A%23include%20%22rgb_lcd.h%22%0D%0A%0D%0A%2F%2F%20Grove%20LCD%20DISPLAY%0D%0Argb_lcd%20lcd%3B%20%20%20%20%20%20%2F%2Finstantiate%20lcd%20Object%0D%0A%0D%0A%2F%2F%20Grove%20TEMPERATURE%20Sensor%0D%0Aconst%20int%20pinTemp%20%3D%20A0%3B%20%20%20%20%20%20%2F%2F%20pin%20of%20temperature%20sensor%0D%0Afloat%20temperature%3B%0D%0Afloat%20TempF%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20tempreture%20in%20ferienheight%0D%0Aint%20B%3D3975%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20B%20value%20of%20the%20thermistor%0D%0Afloat%20resistance%3B%0D%0A%0D%0A%2F%2FGrove%20WATER%20Sensor%0D%0A%23define%20WATER_SENSOR%202%0D%0AString%20WaterStatus%3B%0D%0A%0D%0A%2F%2F%20Grove%20Dust%20Sensor%20%0D%0Aint%20pin%20%3D%204%3B%0D%0Aunsigned%20long%20duration%3B%0D%0Aunsigned%20long%20starttime%3B%0D%0Aunsigned%20long%20sampletime_ms%20%3D%2030000%3B%2F%2Fsampe%2030s%20%3B%0D%0Aunsigned%20long%20lowpulseoccupancy%20%3D%200%3B%0D%0Afloat%20ratio%20%3D%200%3B%0D%0Afloat%20concentration%20%3D%200%3B%0D%0Afloat%20DustStatus%3B%0D%0A%0D%0A%2F%2FDISPLAY%20STRING%0D%0Avoid%20Display%28String%20title%2CString%20message%29%7B%0D%0A%2F%2F%20display%20title%20and%20message%20on%20the%20LCD%20display%0D%0A%2F%2F%20Put%20title%20on%20the%201st%20line%20%0D%0A%2F%2F%20put%20message%20on%20the%202nd%20line%0D%0A%20%20%0D%0A%20%20%2F%2FDISPLAY%20TITLE%0D%0A%20%20%2F%2F%20set%20the%20cursor%20to%20%280%2C0%29%3A%0D%0A%20%20lcd.setCursor%280%2C%200%29%3B%0D%0A%20%20lcd.print%28title%29%3B%0D%0A%20%20lcd.print%28%22%20.%20.%20.%20.%20.%20.%20.%20.%22%29%3B%0D%0A%20%20delay%282000%29%3B%0D%0A%20%0D%0A%20%20%2F%2FDISPLAY%20MESSAGE%20-%20on%20a%20scrolling%20message%20on%20the%202nd%20line%0D%0A%20%20%2F%2F%20set%20the%20cursor%20to%20%2816%2C1%29%3A%0D%0A%20%20lcd.setCursor%2816%2C1%29%3B%0D%0A%20%20%2F%2F%20set%20the%20display%20to%20automatically%20scroll%3A%0D%0A%20%20lcd.autoscroll%28%29%3B%0D%0A%20%20lcd.print%28message%29%3B%0D%0A%20%20delay%282000%29%3B%0D%0A%0D%0A%20%20%2F%2FCLEAN%20UP%0D%0A%20%20%2F%2F%20turn%20off%20automatic%20scrolling%0D%0A%20%20lcd.noAutoscroll%28%29%3B%0D%0A%20%20%2F%2F%20clear%20screen%20for%20the%20next%20Message%0D%0A%20%20lcd.clear%28%29%3B%0D%0A%7D%0D%0A%0D%0Avoid%20setup%28%29%20%7B%0D%0A%20%20%0D%0A%20%20%2F%2F%20Grove%20LCD%20DISPLAY%20SECTION%0D%0A%20%20%2F%2F%20set%20up%20the%20LCD%27s%20number%20of%20columns%20and%20rows%3A%0D%0A%20%20lcd.begin%2816%2C%202%29%3B%0D%0A%0D%0A%20%20%2F%2F%20LoRa%20INIT%20SECTION%0D%0A%20%20%2F%2FSHUT%20OFF%20SERIAL%0D%0A%20%20%2F%2F%20%20Serial.begin%289600%29%3B%0D%0A%20%20%2F%2F%20%20Serial.println%28%22LoRa%20Sender%22%29%3B%0D%0A%20%20Display%28%22LoRa%20Sender%22%2C%22Started...%22%29%3B%0D%0A%20%20if%20%28%21LoRa.begin%28915E6%29%29%20%7B%0D%0A%20%20%20%20while%281%29%7B%0D%0A%20%20%20%20%20%20%2F%2FSHUT%20OFF%20SERIAL%0D%0A%20%20%20%20%20%20Serial.println%28%22Starting%20LoRa%20failed%21%22%29%3B%0D%0A%20%20%20%20%20%20Display%28%22Starting%20LoRa%20%22%2C%22failed%21%22%29%3B%0D%0A%20%20%20%20%7D%20%20%0D%0A%20%20%7D%0D%0A%20%20%0D%0A%20%20%2F%2FGrove%20TEMPERATURE%20%0D%0A%20%20%20%20pinMode%28A0%2CINPUT%29%3B%20%20%20%20%20%20%2F%2FSetting%20the%20A0%20pin%20as%20input%20pin%20to%20take%20data%20from%20the%20temperature%20sensor%20%0D%0A%0D%0A%20%20%2F%2FGrove%20WATER%20Sensor%0D%0A%20%20pinMode%28WATER_SENSOR%2C%20INPUT%29%3B%20%0D%0A%0D%0A%20%20%2F%2F%20Grove%20Dust%20Sensor%20%0D%0A%20%20pinMode%28pin%2CINPUT%29%3B%0D%0A%20%20starttime%20%3D%20millis%28%29%3B%2F%2Fget%20the%20current%20time%3B%0D%0A%0D%0A%7D%0D%0A%0D%0A%0D%0A%0D%0A%2F%2F%20SEND%20LORA%20PACKET%0D%0Avoid%20SendPacket%28String%20type%2C%20String%20value%29%7B%0D%0A%20%20String%20tuple%3B%0D%0A%20%20tuple%20%3D%20String%28type%29%20%2B%20String%28value%29%3B%0D%0A%20%20%0D%0A%20%20%2F%2Fdisplay%20the%20packet%20contents%0D%0A%20%20Display%28%22Sending%20packet%3A%20%22%2C%20tuple%20%29%3B%0D%0A%20%20%2F%2FDisplay%28type%29%3B%0D%0A%20%20%2F%2FDisplay%28value%29%3B%0D%0A%20%20%0D%0A%20%20%2F%2F%20send%20packet%0D%0A%20%20LoRa.beginPacket%28%29%3B%0D%0A%20%20LoRa.print%28type%29%3B%0D%0A%20%20LoRa.print%28value%29%3B%0D%0A%20%20LoRa.endPacket%28%29%3B%0D%0A%7D%0D%0A%0D%0A%2F%2FGET%20THE%20WATER%20DETECT%20VALUE%20%20WET%2FDRY%200%2F1%0D%0AString%20GetWaterStatus%28%29%7B%0D%0A%20%20String%20stat%3B%0D%0A%20%20int%20val%3B%0D%0A%20%20val%20%3D%20digitalRead%28WATER_SENSOR%29%3B%0D%0A%20%20%0D%0A%20%20if%20%28val%20%3D%3D%200%29%7B%0D%0A%20%20%20%20stat%20%3D%20%22WET%22%3B%0D%0A%20%20%7D%0D%0A%20%20if%20%28val%20%3D%3D%201%29%7B%0D%0A%20%20%20%20stat%20%3D%20%22DRY%22%3B%0D%0A%20%20%7D%0D%0A%2F%2F%20%20if%20%28%28val%20%21%3D%200%29%20%7C%7C%20%28val%20%21%3D%201%29%20%29%7B%0D%0A%2F%2F%20%20%20%20stat%20%3D%20%22Water%20Sensor%20ERROR%22%3B%0D%0A%2F%2F%20%20%7D%20%20%0D%0A%20%20return%20stat%3B%0D%0A%7D%0D%0A%0D%0A%2F%2FGET%20DUST%20PARTICLE%20CONCENTRATION%0D%0Afloat%20GetDustParticle%28%29%7B%0D%0A%20%20bool%20finished%20%3D%20false%3B%0D%0A%20%20%0D%0A%20%20do%7B%0D%0A%20%20%20%20%0D%0A%20%20%20%20%20%20duration%20%3D%20pulseIn%28pin%2C%20LOW%29%3B%0D%0A%20%20%20%20%20%20lowpulseoccupancy%20%3D%20lowpulseoccupancy%2Bduration%3B%0D%0A%20%20%20%0D%0A%20%20%20%20%20%20if%20%28%28millis%28%29-starttime%29%20%3E%20sampletime_ms%29%2F%2Fif%20the%20sampel%20time%20%3D%3D%2030s%0D%0A%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20ratio%20%3D%20lowpulseoccupancy%2F%28sampletime_ms%2A10.0%29%3B%20%20%2F%2F%20Integer%20percentage%200%3D%3E100%0D%0A%20%20%20%20%20%20%20%20%20%20concentration%20%3D%201.1%2Apow%28ratio%2C3%29-3.8%2Apow%28ratio%2C2%29%2B520%2Aratio%2B0.62%3B%20%2F%2F%20using%20spec%20sheet%20curve%0D%0A%20%20%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20if%20%28lowpulseoccupancy%20%3E%200%29%0D%0A%20%20%20%20%20%20%20%20%20%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Serial.print%28lowpulseoccupancy%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Serial.print%28%22%2C%22%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Serial.print%28ratio%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Serial.print%28%22%2C%22%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20Serial.println%28concentration%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20lowpulseoccupancy%20%3D%200%3B%0D%0A%20%20%20%20%20%20%20%20%20%20starttime%20%3D%20millis%28%29%3B%0D%0A%20%20%20%20%20%20%20%20%20%20finished%20%3D%20true%3B%0D%0A%20%20%20%20%20%20%7D%0D%0A%20%20%7D%20while%20%28%21finished%29%3B%0D%0A%0D%0A%20%20return%20concentration%3B%0D%0A%20%20%20%20%0D%0A%7D%0D%0A%0D%0A%2F%2FGET%20THE%20CURRENT%20Grove%20Sensor%20TEMPERATURE%0D%0Afloat%20GetTemp%28%29%7B%0D%0A%20%20%0D%0A%20%20int%20val%20%3D%20analogRead%28pinTemp%29%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20get%20analog%20value%0D%0A%20%20resistance%3D%28float%29%281023-val%29%2A10000%2Fval%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20get%20resistance%0D%0A%20%20temperature%3D1%2F%28log%28resistance%2F10000%29%2FB%2B1%2F298.15%29-273.15%3B%20%20%20%20%20%2F%2F%20calc%20temperature%20in%20celsius%0D%0A%20%20TempF%20%3D%20%28temperature%20%2A%209%2F5%29%20%2B%2032%3B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F%20calc%20temp%20in%20ferenheight%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0D%0A%20%20return%20TempF%3B%0D%0A%7D%0D%0A%0D%0Avoid%20loop%28%29%20%7B%0D%0A%0D%0A%20%20%2F%2Fget%20the%20current%20Temperature%0D%0A%20%20TempF%20%3D%20GetTemp%28%29%3B%0D%0A%20%20%2F%2FSEND%20THE%20PACKET%0D%0A%20%20%0D%0A%20%20SendPacket%28%22Temp%3A%22%2CString%28TempF%29%29%3B%0D%0A%0D%0A%20%20%2F%2Fget%20the%20water%20status%0D%0A%20%20WaterStatus%20%3D%20GetWaterStatus%28%29%3B%0D%0A%20%20SendPacket%28%22Water%3A%22%2CWaterStatus%29%3B%0D%0A%0D%0A%20%20%2F%2F%20get%20the%20dust%20particle%20status%20-%20Concentration%0D%0A%20%20DustStatus%20%3D%20GetDustParticle%28%29%3B%0D%0A%20%20SendPacket%28%22Dust%3A%22%2CString%28DustStatus%29%29%3B%20%0D%0A%20%0D%0A%20%20%2F%2Fdelay%285000%29%3B%0D%0A%7D]&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Generated Sketch to&amp;nbsp;&lt;span&gt;run on the Nano 33 IoT&lt;/span&gt;&lt;br /&gt;&lt;span&gt;CODE HAS MOVED TO COMMENTS BELOW&lt;/span&gt;&amp;nbsp;:&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=23099&amp;AppID=75&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>