{"action":"created","issue":{"url":"https://api.github.com/repos/spark/firmware/issues/610","labels_url":"https://api.github.com/repos/spark/firmware/issues/610/labels{/name}","comments_url":"https://api.github.com/repos/spark/firmware/issues/610/comments","events_url":"https://api.github.com/repos/spark/firmware/issues/610/events","html_url":"https://github.com/spark/firmware/pull/610","id":106259340,"number":610,"title":"Serial.flush()","user":{"login":"m-mcgowan","id":2465470,"avatar_url":"https://avatars.githubusercontent.com/u/2465470?v=3","gravatar_id":"","url":"https://api.github.com/users/m-mcgowan","html_url":"https://github.com/m-mcgowan","followers_url":"https://api.github.com/users/m-mcgowan/followers","following_url":"https://api.github.com/users/m-mcgowan/following{/other_user}","gists_url":"https://api.github.com/users/m-mcgowan/gists{/gist_id}","starred_url":"https://api.github.com/users/m-mcgowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-mcgowan/subscriptions","organizations_url":"https://api.github.com/users/m-mcgowan/orgs","repos_url":"https://api.github.com/users/m-mcgowan/repos","events_url":"https://api.github.com/users/m-mcgowan/events{/privacy}","received_events_url":"https://api.github.com/users/m-mcgowan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spark/firmware/labels/in%20progress","name":"in progress","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/spark/firmware/milestones/11","html_url":"https://github.com/spark/firmware/milestones/0.4.6","labels_url":"https://api.github.com/repos/spark/firmware/milestones/11/labels","id":1268393,"number":11,"title":"0.4.6","description":null,"creator":{"login":"m-mcgowan","id":2465470,"avatar_url":"https://avatars.githubusercontent.com/u/2465470?v=3","gravatar_id":"","url":"https://api.github.com/users/m-mcgowan","html_url":"https://github.com/m-mcgowan","followers_url":"https://api.github.com/users/m-mcgowan/followers","following_url":"https://api.github.com/users/m-mcgowan/following{/other_user}","gists_url":"https://api.github.com/users/m-mcgowan/gists{/gist_id}","starred_url":"https://api.github.com/users/m-mcgowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-mcgowan/subscriptions","organizations_url":"https://api.github.com/users/m-mcgowan/orgs","repos_url":"https://api.github.com/users/m-mcgowan/repos","events_url":"https://api.github.com/users/m-mcgowan/events{/privacy}","received_events_url":"https://api.github.com/users/m-mcgowan/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":3,"state":"open","created_at":"2015-08-23T22:45:17Z","updated_at":"2015-09-14T12:07:10Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-09-14T02:22:32Z","updated_at":"2015-09-14T14:41:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/spark/firmware/pulls/610","html_url":"https://github.com/spark/firmware/pull/610","diff_url":"https://github.com/spark/firmware/pull/610.diff","patch_url":"https://github.com/spark/firmware/pull/610.patch"},"body":"Attempting to fix this, but this is not a solution since there is no way to know if there is a USB device connected that will consume the data.  While there is no device connected, the application will wait indefinitely for the data to be sent, blocking the call to flush().\r\n\r\nIt's not clear to me if that should be the correct behaviour. I can see it breaking existing programs.\r\n\r\nHere's a test app:\r\n\r\n```\r\nvoid setup()\r\n{\r\n    Serial.begin(9600);\r\n    pinMode(D7, OUTPUT);\r\n}\r\n\r\nvoid loop()\r\n{\r\n    Serial.println(\"Hello world here is a very long string to full a buffer\");\r\n    Serial.flush();\r\n    delay(1000);\r\n    digitalWrite(D7, !digitalRead(D7));\r\n}\r\n```\r\n\r\nWhen the serial monitor is open (e.g. screen on OSX) then the application prints data and the D7 LED flashes on and off. Once the serial monitor is closed, the LED stops blinking for 10s (the default timeout.)"},"comment":{"url":"https://api.github.com/repos/spark/firmware/issues/comments/140102142","html_url":"https://github.com/spark/firmware/pull/610#issuecomment-140102142","issue_url":"https://api.github.com/repos/spark/firmware/issues/610","id":140102142,"user":{"login":"m-mcgowan","id":2465470,"avatar_url":"https://avatars.githubusercontent.com/u/2465470?v=3","gravatar_id":"","url":"https://api.github.com/users/m-mcgowan","html_url":"https://github.com/m-mcgowan","followers_url":"https://api.github.com/users/m-mcgowan/followers","following_url":"https://api.github.com/users/m-mcgowan/following{/other_user}","gists_url":"https://api.github.com/users/m-mcgowan/gists{/gist_id}","starred_url":"https://api.github.com/users/m-mcgowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-mcgowan/subscriptions","organizations_url":"https://api.github.com/users/m-mcgowan/orgs","repos_url":"https://api.github.com/users/m-mcgowan/repos","events_url":"https://api.github.com/users/m-mcgowan/events{/privacy}","received_events_url":"https://api.github.com/users/m-mcgowan/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T14:41:09Z","updated_at":"2015-09-14T14:41:09Z","body":"Not over USB"}}