{"action":"created","issue":{"url":"https://api.github.com/repos/scottbez1/splitflap/issues/32","repository_url":"https://api.github.com/repos/scottbez1/splitflap","labels_url":"https://api.github.com/repos/scottbez1/splitflap/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/scottbez1/splitflap/issues/32/comments","events_url":"https://api.github.com/repos/scottbez1/splitflap/issues/32/events","html_url":"https://github.com/scottbez1/splitflap/issues/32","id":346322509,"node_id":"MDU6SXNzdWUzNDYzMjI1MDk=","number":32,"title":"Provide example Arduino code for basic single-module breadboard configuration (no shift register)","user":{"login":"scottbez1","id":414890,"node_id":"MDQ6VXNlcjQxNDg5MA==","avatar_url":"https://avatars3.githubusercontent.com/u/414890?v=4","gravatar_id":"","url":"https://api.github.com/users/scottbez1","html_url":"https://github.com/scottbez1","followers_url":"https://api.github.com/users/scottbez1/followers","following_url":"https://api.github.com/users/scottbez1/following{/other_user}","gists_url":"https://api.github.com/users/scottbez1/gists{/gist_id}","starred_url":"https://api.github.com/users/scottbez1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottbez1/subscriptions","organizations_url":"https://api.github.com/users/scottbez1/orgs","repos_url":"https://api.github.com/users/scottbez1/repos","events_url":"https://api.github.com/users/scottbez1/events{/privacy}","received_events_url":"https://api.github.com/users/scottbez1/received_events","type":"User","site_admin":false},"labels":[{"id":1010649636,"node_id":"MDU6TGFiZWwxMDEwNjQ5NjM2","url":"https://api.github.com/repos/scottbez1/splitflap/labels/documentation","name":"documentation","color":"bcbcbc","default":false},{"id":268714492,"node_id":"MDU6TGFiZWwyNjg3MTQ0OTI=","url":"https://api.github.com/repos/scottbez1/splitflap/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":268714493,"node_id":"MDU6TGFiZWwyNjg3MTQ0OTM=","url":"https://api.github.com/repos/scottbez1/splitflap/labels/help%20wanted","name":"help wanted","color":"159818","default":true},{"id":1010630466,"node_id":"MDU6TGFiZWwxMDEwNjMwNDY2","url":"https://api.github.com/repos/scottbez1/splitflap/labels/software","name":"software","color":"f7aaf0","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-31T19:16:01Z","updated_at":"2018-08-21T04:33:40Z","closed_at":"2018-08-21T04:33:40Z","author_association":"OWNER","body":"For ease of experimentation, especially for hobbyists who don't have the experience or desire to order custom PCBs, it would be nice to provide some sample Arduino code for driving a single splitflap module using a basic standard ULN2003A control board rather than the shift-register based custom PCB.\r\n\r\nIt should be pretty easy, as the SplitflapModule just operates on half of a uint8_t buffer for motor output and a single bit of a uint8_t buffer for sensor input:\r\n\r\n```\r\n  SplitflapModule(\r\n    uint8_t &motor_out,\r\n    const uint8_t motor_bitshift,\r\n    uint8_t &sensor_in,\r\n    const uint8_t sensor_bitmask\r\n  );\r\n```\r\n\r\n```\r\ninline void SplitflapModule::SetMotor(uint8_t out) {\r\n  motor_out = (motor_out & ~(0x0F << motor_bitshift)) | ((out & 0x0F) << motor_bitshift);\r\n}\r\n```\r\n\r\n```\r\nbool SplitflapModule::CheckSensor() {\r\n    bool cur_home = (sensor_in & sensor_bitmask) != 0;\r\n    bool shift = cur_home == true && last_home == false;\r\n    last_home = cur_home;\r\n\r\n    return shift;\r\n}\r\n```\r\n\r\nIt may even be possible to just instantiate a `SplitflapModule` instance by directly passing e.g. `PORTD` as the motor_out reference and e.g. `PORTC` as the sensor_in reference, since SplitflapModule already safely writes all 4 bits to the motor_out reference in a single operation.\r\n\r\nWould also be nice to provide a Fritzing circuit/breadboard diagram on the wiki for how to wire it up."},"comment":{"url":"https://api.github.com/repos/scottbez1/splitflap/issues/comments/414546867","html_url":"https://github.com/scottbez1/splitflap/issues/32#issuecomment-414546867","issue_url":"https://api.github.com/repos/scottbez1/splitflap/issues/32","id":414546867,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDU0Njg2Nw==","user":{"login":"scottbez1","id":414890,"node_id":"MDQ6VXNlcjQxNDg5MA==","avatar_url":"https://avatars3.githubusercontent.com/u/414890?v=4","gravatar_id":"","url":"https://api.github.com/users/scottbez1","html_url":"https://github.com/scottbez1","followers_url":"https://api.github.com/users/scottbez1/followers","following_url":"https://api.github.com/users/scottbez1/following{/other_user}","gists_url":"https://api.github.com/users/scottbez1/gists{/gist_id}","starred_url":"https://api.github.com/users/scottbez1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottbez1/subscriptions","organizations_url":"https://api.github.com/users/scottbez1/orgs","repos_url":"https://api.github.com/users/scottbez1/repos","events_url":"https://api.github.com/users/scottbez1/events{/privacy}","received_events_url":"https://api.github.com/users/scottbez1/received_events","type":"User","site_admin":false},"created_at":"2018-08-21T04:33:40Z","updated_at":"2018-08-21T04:33:40Z","author_association":"OWNER","body":"The wiring diagram and description has been added to the wiki: https://github.com/scottbez1/splitflap/wiki/Electronics#basic-prototyping-alternative-electronics-approach"}}
{"actor":{"display_login":"scottbez1"}}