{"action":"created","issue":{"url":"https://api.github.com/repos/ev3dev/ev3dev/issues/770","repository_url":"https://api.github.com/repos/ev3dev/ev3dev","labels_url":"https://api.github.com/repos/ev3dev/ev3dev/issues/770/labels{/name}","comments_url":"https://api.github.com/repos/ev3dev/ev3dev/issues/770/comments","events_url":"https://api.github.com/repos/ev3dev/ev3dev/issues/770/events","html_url":"https://github.com/ev3dev/ev3dev/issues/770","id":186418572,"number":770,"title":"How to write hardware controlling libraries?","user":{"login":"crossroads-robot","id":23131561,"avatar_url":"https://avatars.githubusercontent.com/u/23131561?v=3","gravatar_id":"","url":"https://api.github.com/users/crossroads-robot","html_url":"https://github.com/crossroads-robot","followers_url":"https://api.github.com/users/crossroads-robot/followers","following_url":"https://api.github.com/users/crossroads-robot/following{/other_user}","gists_url":"https://api.github.com/users/crossroads-robot/gists{/gist_id}","starred_url":"https://api.github.com/users/crossroads-robot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crossroads-robot/subscriptions","organizations_url":"https://api.github.com/users/crossroads-robot/orgs","repos_url":"https://api.github.com/users/crossroads-robot/repos","events_url":"https://api.github.com/users/crossroads-robot/events{/privacy}","received_events_url":"https://api.github.com/users/crossroads-robot/received_events","type":"User","site_admin":false},"labels":[{"id":58783641,"url":"https://api.github.com/repos/ev3dev/ev3dev/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-10-31T22:43:25Z","updated_at":"2016-11-01T01:20:13Z","closed_at":null,"body":"One question. I am not a software engineer but a biomedical engineer. I know linux and Python.  I want to know how were these libraries written to control the hardware like motors, sensors.  What kind of knowledge do i need to write such hardware controlling library. I was planning to see if i can get any ultrasonic sensor (not lego) and interface it with ev3. is that possible? "},"comment":{"url":"https://api.github.com/repos/ev3dev/ev3dev/issues/comments/257467279","html_url":"https://github.com/ev3dev/ev3dev/issues/770#issuecomment-257467279","issue_url":"https://api.github.com/repos/ev3dev/ev3dev/issues/770","id":257467279,"user":{"login":"crossroads-robot","id":23131561,"avatar_url":"https://avatars.githubusercontent.com/u/23131561?v=3","gravatar_id":"","url":"https://api.github.com/users/crossroads-robot","html_url":"https://github.com/crossroads-robot","followers_url":"https://api.github.com/users/crossroads-robot/followers","following_url":"https://api.github.com/users/crossroads-robot/following{/other_user}","gists_url":"https://api.github.com/users/crossroads-robot/gists{/gist_id}","starred_url":"https://api.github.com/users/crossroads-robot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crossroads-robot/subscriptions","organizations_url":"https://api.github.com/users/crossroads-robot/orgs","repos_url":"https://api.github.com/users/crossroads-robot/repos","events_url":"https://api.github.com/users/crossroads-robot/events{/privacy}","received_events_url":"https://api.github.com/users/crossroads-robot/received_events","type":"User","site_admin":false},"created_at":"2016-11-01T01:20:12Z","updated_at":"2016-11-01T01:20:12Z","body":"Thank you guys.\n\n> On Oct 31, 2016, at 7:37 PM, David Lechner <notifications@github.com> wrote:\n> \n> For the lego hardware, how did you guys write the libraries\n> \n> First, we wrote kernel drivers <https://github.com/ev3dev/lego-linux-drivers> that expose the hardware as attribute files via sysfs <https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt>.\n> \n> The libraries then use these sysfs attributes to monitor and control the hardware. The kernel drivers are documented here <http://www.ev3dev.org/docs/driver-overview/>. The libraries are written by applying the information in the docs to the language of your choice.\n> \n> Suppose i want to write a library for lego touch sensor, how would i go about doing that?\n> \n> For a touch sensor, you will need to know about the lego-sensor class <http://www.ev3dev.org/docs/drivers/user-lego-sensor/> and the touch sensor <http://www.ev3dev.org/docs/sensors/lego-ev3-touch-sensor/> itself. You need to write code that opens the sysfs attribute files and read/write to them as described in the driver docs. Each attribute serves a specific purpose. The main one you would be interested in for a touch sensor would be the value0 attribute of the lego-sensor class. So, you might read the file /sys/class/lego-sensor/sensor0/value0 and find that it has the value 0\\n (\\n is a newline character).\n> \n> There are several python libraries for ev3dev already. You can have a look to see how they did it.\n> \n> ev3dev-lang-python <https://github.com/rhempel/ev3dev-lang-python>\n> python-ev3 <https://github.com/topikachu/python-ev3/>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly, view it on GitHub <https://github.com/ev3dev/ev3dev/issues/770#issuecomment-257451145>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AWD1qThVnzUhr0NCt72EVgzRlbvbCivXks5q5nu5gaJpZM4KlmAS>.\n> \n\n"}}
{"actor":{"display_login":"crossroads-robot"}}