{"action":"opened","issue":{"url":"https://api.github.com/repos/mathertel/OneButton/issues/44","repository_url":"https://api.github.com/repos/mathertel/OneButton","labels_url":"https://api.github.com/repos/mathertel/OneButton/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/mathertel/OneButton/issues/44/comments","events_url":"https://api.github.com/repos/mathertel/OneButton/issues/44/events","html_url":"https://github.com/mathertel/OneButton/issues/44","id":385303622,"node_id":"MDU6SXNzdWUzODUzMDM2MjI=","number":44,"title":"trying to create 3 buttons fails","user":{"login":"dsyleixa","id":29887867,"node_id":"MDQ6VXNlcjI5ODg3ODY3","avatar_url":"https://avatars1.githubusercontent.com/u/29887867?v=4","gravatar_id":"","url":"https://api.github.com/users/dsyleixa","html_url":"https://github.com/dsyleixa","followers_url":"https://api.github.com/users/dsyleixa/followers","following_url":"https://api.github.com/users/dsyleixa/following{/other_user}","gists_url":"https://api.github.com/users/dsyleixa/gists{/gist_id}","starred_url":"https://api.github.com/users/dsyleixa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsyleixa/subscriptions","organizations_url":"https://api.github.com/users/dsyleixa/orgs","repos_url":"https://api.github.com/users/dsyleixa/repos","events_url":"https://api.github.com/users/dsyleixa/events{/privacy}","received_events_url":"https://api.github.com/users/dsyleixa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-28T14:50:58Z","updated_at":"2018-11-28T14:50:58Z","closed_at":null,"author_association":"NONE","body":"hello,\r\ntrying to create 3 buttons fails:\r\n\r\n> exit status 1\r\n> 'click3' was not declared in this scope\r\n> \r\n why is that so, what is missing?\r\n\r\n```\r\n/*\r\n This is a sample sketch to show how to use the OneButtonLibrary\r\n to detect click events on 2 buttons in parallel. \r\n The library internals are explained at\r\n http://www.mathertel.de/Arduino/OneButtonLibrary.aspx \r\n https://github.com/mathertel/OneButton\r\n \r\n Setup a test circuit:\r\n * Connect a pushbutton to pin A1 (ButtonPin) and ground.\r\n * Connect a pushbutton to pin A2 (ButtonPin) and ground.\r\n * The Serial interface is used for output the detected button events.\r\n \r\n The Sketch shows how to setup the library and bind 2 buttons to their functions.\r\n In the loop function the button1.tick and button2.tick functions have to be called as often as you like.\r\n */\r\n\r\n// 01.03.2014 created by Matthias Hertel\r\n// ... and working.\r\n\r\n/* Sample output:\r\n\r\nStarting TwoButtons...\r\nButton 1 click.\r\nButton 2 click.\r\nButton 1 doubleclick.\r\nButton 2 doubleclick.\r\nButton 1 longPress start\r\nButton 1 longPress...\r\nButton 1 longPress...\r\nButton 1 longPress...\r\nButton 1 longPress stop\r\nButton 2 longPress start\r\nButton 2 longPress...\r\nButton 2 longPress...\r\nButton 2 longPress stop\r\n\r\n*/\r\n\r\n#include \"OneButton.h\"\r\n\r\n// Setup a new OneButton   \r\nOneButton button1(D4, true);\r\nOneButton button2(D5, true);\r\nOneButton button3(D6, true);\r\n\r\n\r\n//------------------------------------------------------------ \r\n// setup \r\nvoid setup() {\r\n  // Setup the Serial port.  \r\n  Serial.begin(115200);\r\n  delay(2000);\r\n  Serial.println(\"Starting TwoButtons...\");\r\n\r\n  // link the button 1 functions.\r\n  button1.attachClick(click1);\r\n  button1.attachDoubleClick(doubleclick1);\r\n  button1.attachLongPressStart(longPressStart1);\r\n  button1.attachLongPressStop(longPressStop1);\r\n  button1.attachDuringLongPress(longPress1);\r\n\r\n  // link the button 2 functions.\r\n  button2.attachClick(click2);\r\n  button2.attachDoubleClick(doubleclick2);\r\n  button2.attachLongPressStart(longPressStart2);\r\n  button2.attachLongPressStop(longPressStop2);\r\n  button2.attachDuringLongPress(longPress2);\r\n\r\n  // link the button 3 functions.\r\n  button3.attachClick(click3);\r\n  button3.attachDoubleClick(doubleclick3);\r\n  button3.attachLongPressStart(longPressStart3);\r\n  button3.attachLongPressStop(longPressStop3);\r\n  button3.attachDuringLongPress(longPress3);\r\n\r\n\r\n} \r\n\r\n//------------------------------------------------------------ \r\n// loop\r\n\r\nvoid loop() {\r\n  // keep watching the push buttons:\r\n  button1.tick();\r\n  button2.tick();\r\n\r\n\r\n  delay(10);\r\n} // loop\r\n\r\n\r\n//------------------------------------------------------------ \r\n// ----- button 1 callback functions\r\n\r\n// This function will be called when the button1 was pressed 1 time (and no 2. button press followed).\r\nvoid click1() {\r\n  Serial.println(\"Button 1 click.\");\r\n} // click1\r\n\r\n\r\n// This function will be called when the button1 was pressed 2 times in a short timeframe.\r\nvoid doubleclick1() {\r\n  Serial.println(\"Button 1 doubleclick.\");\r\n} // doubleclick1\r\n\r\n\r\n// This function will be called once, when the button1 is pressed for a long time.\r\nvoid longPressStart1() {\r\n  Serial.println(\"Button 1 longPress start\");\r\n} // longPressStart1\r\n\r\n\r\n// This function will be called often, while the button1 is pressed for a long time.\r\nvoid longPress1() {\r\n  //Serial.println(\"Button 1 longPress...\");\r\n} // longPress1\r\n\r\n\r\n// This function will be called once, when the button1 is released after beeing pressed for a long time.\r\nvoid longPressStop1() {\r\n  Serial.println(\"Button 1 longPress stop/true\");\r\n} // longPressStop1\r\n\r\n\r\n// ... and the same for button 2:\r\n\r\nvoid click2() {\r\n  Serial.println(\"Button 2 click.\");\r\n} // click2\r\n\r\n\r\nvoid doubleclick2() {\r\n  Serial.println(\"Button 2 doubleclick.\");\r\n} // doubleclick2\r\n\r\n\r\nvoid longPressStart2() {\r\n  Serial.println(\"Button 2 longPress start\");\r\n} // longPressStart2\r\n\r\n\r\nvoid longPress2() {\r\n  Serial.println(\"Button 2 longPress...\");\r\n} // longPress2\r\n\r\nvoid longPressStop2() {\r\n  Serial.println(\"Button 2 longPress stop\");\r\n} // longPressStop2\r\n\r\n// End\r\n\r\n\r\n```\r\n"}}
{"actor":{"display_login":"dsyleixa"}}