{"action":"created","issue":{"url":"https://api.github.com/repos/adafruit/Adafruit_CircuitPlayground/issues/17","repository_url":"https://api.github.com/repos/adafruit/Adafruit_CircuitPlayground","labels_url":"https://api.github.com/repos/adafruit/Adafruit_CircuitPlayground/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/adafruit/Adafruit_CircuitPlayground/issues/17/comments","events_url":"https://api.github.com/repos/adafruit/Adafruit_CircuitPlayground/issues/17/events","html_url":"https://github.com/adafruit/Adafruit_CircuitPlayground/issues/17","id":186856127,"number":17,"title":"Should playTone() be blocking?","user":{"login":"caternuson","id":8755041,"avatar_url":"https://avatars.githubusercontent.com/u/8755041?v=3","gravatar_id":"","url":"https://api.github.com/users/caternuson","html_url":"https://github.com/caternuson","followers_url":"https://api.github.com/users/caternuson/followers","following_url":"https://api.github.com/users/caternuson/following{/other_user}","gists_url":"https://api.github.com/users/caternuson/gists{/gist_id}","starred_url":"https://api.github.com/users/caternuson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caternuson/subscriptions","organizations_url":"https://api.github.com/users/caternuson/orgs","repos_url":"https://api.github.com/users/caternuson/repos","events_url":"https://api.github.com/users/caternuson/events{/privacy}","received_events_url":"https://api.github.com/users/caternuson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-02T16:46:58Z","updated_at":"2016-11-02T17:40:42Z","closed_at":null,"body":"- Arduino board:  Circuit Playground  (library up to 1.6.3)\r\n- Arduino IDE version (found in Arduino -> About Arduino menu):  1.6.11\r\n- List the steps to reproduce the problem below (if possible attach a sketch or\r\n  copy the sketch code in too): Use playTone() without delay()\r\n\r\nRef. this forum thread:\r\nhttps://forums.adafruit.com/viewtopic.php?f=58&t=102459\r\n\r\nRef. current library documentation:\r\nhttps://learn.adafruit.com/circuit-playground-lesson-number-0/mini-speaker#library-reference\r\n\r\nRef. CircuitPlayground library playTone() function:\r\nhttps://github.com/adafruit/Adafruit_CircuitPlayground/blob/master/Adafruit_CircuitPlayground.cpp#L79\r\n\r\nRef. Arduino library tone() function:\r\nhttps://www.arduino.cc/en/Reference/Tone\r\n\r\nThe current Circuit Playground `playTone()` function simply calls the Arduino library `tone()` function. The tone generation is done using timer interrupts. The call to `tone()` configures the timer and returns. This leads to the following lines of code only producing the second (800Hz) sound:\r\n\r\n```C++\r\nCircuitPlayground.playTone(500, 1000);\r\nCircuitPlayground.playTone(800, 1000);\r\n```\r\n\r\nThis is fixed quite simply using delay():\r\n\r\n```C++\r\nCircuitPlayground.playTone(500, 1000); delay(1000);\r\nCircuitPlayground.playTone(800, 1000); delay(1000);\r\n```\r\n\r\nHowever, a blocking behaviour may be better suited for CircuitPlayground. Or at least the option for both (blocking/non-blocking) with blocking being the default.\r\n"},"comment":{"url":"https://api.github.com/repos/adafruit/Adafruit_CircuitPlayground/issues/comments/257941667","html_url":"https://github.com/adafruit/Adafruit_CircuitPlayground/issues/17#issuecomment-257941667","issue_url":"https://api.github.com/repos/adafruit/Adafruit_CircuitPlayground/issues/17","id":257941667,"user":{"login":"ladyada","id":1214161,"avatar_url":"https://avatars.githubusercontent.com/u/1214161?v=3","gravatar_id":"","url":"https://api.github.com/users/ladyada","html_url":"https://github.com/ladyada","followers_url":"https://api.github.com/users/ladyada/followers","following_url":"https://api.github.com/users/ladyada/following{/other_user}","gists_url":"https://api.github.com/users/ladyada/gists{/gist_id}","starred_url":"https://api.github.com/users/ladyada/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ladyada/subscriptions","organizations_url":"https://api.github.com/users/ladyada/orgs","repos_url":"https://api.github.com/users/ladyada/repos","events_url":"https://api.github.com/users/ladyada/events{/privacy}","received_events_url":"https://api.github.com/users/ladyada/received_events","type":"User","site_admin":false},"created_at":"2016-11-02T17:40:42Z","updated_at":"2016-11-02T17:40:42Z","body":"oh thats odd, i thought tone() was blocking? ok well which do you think we should do? :)"}}
{"actor":{"display_login":"ladyada"}}