{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-iot-device-sdk-arduino-yun/issues/58","repository_url":"https://api.github.com/repos/aws/aws-iot-device-sdk-arduino-yun","labels_url":"https://api.github.com/repos/aws/aws-iot-device-sdk-arduino-yun/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-iot-device-sdk-arduino-yun/issues/58/comments","events_url":"https://api.github.com/repos/aws/aws-iot-device-sdk-arduino-yun/issues/58/events","html_url":"https://github.com/aws/aws-iot-device-sdk-arduino-yun/issues/58","id":261954106,"number":58,"title":"Getting help and delay(10000)","user":{"login":"flycast","id":32281377,"avatar_url":"https://avatars3.githubusercontent.com/u/32281377?v=4","gravatar_id":"","url":"https://api.github.com/users/flycast","html_url":"https://github.com/flycast","followers_url":"https://api.github.com/users/flycast/followers","following_url":"https://api.github.com/users/flycast/following{/other_user}","gists_url":"https://api.github.com/users/flycast/gists{/gist_id}","starred_url":"https://api.github.com/users/flycast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flycast/subscriptions","organizations_url":"https://api.github.com/users/flycast/orgs","repos_url":"https://api.github.com/users/flycast/repos","events_url":"https://api.github.com/users/flycast/events{/privacy}","received_events_url":"https://api.github.com/users/flycast/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-01T23:06:41Z","updated_at":"2017-10-02T00:06:01Z","closed_at":null,"author_association":"NONE","body":"Two questions:\r\n\r\nIs this the best place to get help with AWS/Arduino Yun and this SDK? I have posted a couple of times last week only to receive deafening silence.\r\n\r\nI am connected and am seeing messages published now...yay! \r\n\r\nI found that if I change the delay(1000) to delay(10000) in the following code:\r\n```\r\nvoid loop() {\r\n  if(success_connect) {\r\n    // Generate a new message in each loop and publish to \"topic1\"\r\n    sprintf(msg, \"new message %d\", cnt);\r\n    if((rc = myClient.publish(\"topic1\", msg, strlen(msg), 1, false)) != 0) {\r\n      Serial.println(F(\"Publish failed!\"));\r\n      Serial.println(rc);\r\n    }\r\n  \r\n    // Get a chance to run a callback\r\n    if((rc = myClient.yield()) != 0) {\r\n      Serial.println(\"Yield failed!\");\r\n      Serial.println(rc);\r\n    }\r\n  \r\n    // Done with the current loop\r\n    sprintf_P(msg, PSTR(\"loop %d done\"), cnt++);\r\n    Serial.println(msg);\r\n  \r\n    delay(9925);\r\n  }\r\n}\r\n```\r\n\r\nI get to following errors:\r\n\r\n> AWS IoT SDK Version(dev) 2.2.0-\r\n> \r\n> loop 0 done\r\n> Publish failed!\r\n> -1\r\n> Yield failed!\r\n> -35\r\n> loop 1 done\r\n\r\nTweaking somewhat I have found that it stops working when the delay value is somewhere between 9925 and 10000. Reading the docs on delay I find the following:\r\n\r\n> While it is easy to create a blinking LED with the delay() function, and many sketches use short delays for such tasks as switch debouncing, the use of delay() in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay() for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.\r\n\r\nWhat is happening here? Is the delay tying up the Yun and preventing communications through the bridge or something?"},"comment":{"url":"https://api.github.com/repos/aws/aws-iot-device-sdk-arduino-yun/issues/comments/333416522","html_url":"https://github.com/aws/aws-iot-device-sdk-arduino-yun/issues/58#issuecomment-333416522","issue_url":"https://api.github.com/repos/aws/aws-iot-device-sdk-arduino-yun/issues/58","id":333416522,"user":{"login":"flycast","id":32281377,"avatar_url":"https://avatars3.githubusercontent.com/u/32281377?v=4","gravatar_id":"","url":"https://api.github.com/users/flycast","html_url":"https://github.com/flycast","followers_url":"https://api.github.com/users/flycast/followers","following_url":"https://api.github.com/users/flycast/following{/other_user}","gists_url":"https://api.github.com/users/flycast/gists{/gist_id}","starred_url":"https://api.github.com/users/flycast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flycast/subscriptions","organizations_url":"https://api.github.com/users/flycast/orgs","repos_url":"https://api.github.com/users/flycast/repos","events_url":"https://api.github.com/users/flycast/events{/privacy}","received_events_url":"https://api.github.com/users/flycast/received_events","type":"User","site_admin":false},"created_at":"2017-10-02T00:06:01Z","updated_at":"2017-10-02T00:06:01Z","author_association":"NONE","body":"More information on this...\r\nReading about adding the line after line 851:\r\n`\tSerial.println(rw_buf);\r\n`\r\nto this file https://github.com/aws/aws-iot-device-sdk-arduino-yun/blob/master/AWS-IoT-Arduino-Yun-Library/aws_iot_mqtt.cpp#L851\r\n\r\nI get the following information in the serial monitor:\r\n\r\nFirst, a good message:\r\n\r\n> \r\n> \r\n> \r\n> \r\n> \r\n> P T\r\n> \r\n> Z T\r\n> \r\n> Y 0 0 new message 2\r\n> CALLBACK:\r\n> new message 2\r\n> \r\n> Y F: No messages.\r\n\r\nThe I wait a minute and the I get (the \"Exe\" is really missing from the first line):\r\n\r\n> eption in thread Thread-1 (most likely raised during interpr5\r\n> /bin/ash: p: not found\r\n> /bin/ash: topic1: not found\r\n> /bin/ash: new: not found\r\n> /bin/ash: 1: not found\r\n> /bin/ash: 0: not found\r\n> Publish failed!\r\n> -1\r\n> /bin/ash: 1: not found\r\n> /bin/ash: z: not found\r\n> Yield failed!\r\n> -35\r\n\r\nAfter that no matter how long I wait I get (notice the missing exception in thread1?:\r\n\r\n> /bin/ash: 5: not found\r\n> /bin/ash: p: not found\r\n> /bin/ash: topic1: not found\r\n> /bin/ash: new: not found\r\n> /bin/ash: 1: not found\r\n> /bin/ash: 0: not found\r\n> Publish failed!\r\n> -1\r\n> /bin/ash: 1: not found\r\n> /bin/ash: z: not found\r\n> Yield failed!\r\n> -35\r\n> \r\n\r\nSorry for my lack of knowledge."}}
{"actor":{"display_login":"flycast"}}