{"action":"created","issue":{"url":"https://api.github.com/repos/monami-ya-mrb/mruby-serialport/issues/1","labels_url":"https://api.github.com/repos/monami-ya-mrb/mruby-serialport/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/monami-ya-mrb/mruby-serialport/issues/1/comments","events_url":"https://api.github.com/repos/monami-ya-mrb/mruby-serialport/issues/1/events","html_url":"https://github.com/monami-ya-mrb/mruby-serialport/issues/1","id":116976335,"number":1,"title":"Running the example","user":{"login":"tworitdash","id":5251113,"avatar_url":"https://avatars.githubusercontent.com/u/5251113?v=3","gravatar_id":"","url":"https://api.github.com/users/tworitdash","html_url":"https://github.com/tworitdash","followers_url":"https://api.github.com/users/tworitdash/followers","following_url":"https://api.github.com/users/tworitdash/following{/other_user}","gists_url":"https://api.github.com/users/tworitdash/gists{/gist_id}","starred_url":"https://api.github.com/users/tworitdash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tworitdash/subscriptions","organizations_url":"https://api.github.com/users/tworitdash/orgs","repos_url":"https://api.github.com/users/tworitdash/repos","events_url":"https://api.github.com/users/tworitdash/events{/privacy}","received_events_url":"https://api.github.com/users/tworitdash/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-11-15T06:22:51Z","updated_at":"2015-11-17T10:44:38Z","closed_at":null,"body":"I am pretty new to mruby. I want to run a serialport program from my raspberry pi to a ARM Cortex M4, which has been programmed to perform some tasks upon some instructions. I want to provide the instructions from a mruby program. My build_config.rb looks like this. \r\n\r\n```ruby\r\n############################\r\n# Start of your build_config\r\n\r\nMRuby::Build.new do |conf|\r\n  toolchain :gcc\r\n\r\n  conf.bins = %w(mrbc)\r\n\r\n  # mruby's Core GEMs\r\n  conf.gem 'mrbgems/mruby-bin-mirb'\r\n  conf.gem 'mrbgems/mruby-bin-mruby'\r\n  conf.gem 'mrbgems/mruby-array-ext'\r\n  conf.gem 'mrbgems/mruby-enum-ext'\r\n  conf.gem 'mrbgems/mruby-eval'\r\n  conf.gem 'mrbgems/mruby-exit'\r\n  conf.gem 'mrbgems/mruby-fiber'\r\n  conf.gem 'mrbgems/mruby-hash-ext'\r\n  conf.gem 'mrbgems/mruby-math'\r\n  conf.gem 'mrbgems/mruby-numeric-ext'\r\n  conf.gem 'mrbgems/mruby-object-ext'\r\n  conf.gem 'mrbgems/mruby-objectspace'\r\n  conf.gem 'mrbgems/mruby-print'\r\n  conf.gem 'mrbgems/mruby-proc-ext'\r\n  conf.gem 'mrbgems/mruby-random'\r\n  conf.gem 'mrbgems/mruby-range-ext'\r\n  conf.gem 'mrbgems/mruby-sprintf'\r\n  conf.gem 'mrbgems/mruby-string-ext'\r\n#  conf.gem 'mrbgems/mruby-string-utf8'\r\n  conf.gem 'mrbgems/mruby-struct'\r\n  conf.gem 'mrbgems/mruby-symbol-ext'\r\n  conf.gem 'mrbgems/mruby-time'\r\n  conf.gem 'mrbgems/mruby-toplevel-ext'\r\n\r\n  # user-defined GEMs\r\n  conf.gem :git => 'https://github.com/monami-ya-mrb/mruby-serialport.git'\r\nend\r\n\r\n# End of your build_config\r\n############################\r\n```\r\n\r\nThen I aaded unistd.h and string.h in serport-impl-posix.c in mruby/build/mrbgems/mruby-serialport/src to avoid some errors of undefined function declarations. Then I did this \r\n    sudo rake\r\nAnd it was successfully built. \r\nNow I see a serialport.rb file in the test directory of the gem which is similar to what I write in ruby for serialport programming. Hence, I changed it a bit to write some characters to the serialport where my ARM Controller has been connected. My serialport.rb looks like this.\r\n\r\n```ruby\r\nassert(\"serial\") do\r\n  sp = SerialPort.new(\"/dev/ttyACM0\", 115200, 8, 1, 0)\r\n  sp.read_timeout=1000\r\n  wait_time = 4\r\n  sp.puts \"foobarbaz\"\r\n  sp.gets == \"foobarbaz\\n\"\r\n  list = [\"f\", \"l\", \"r\", \"b\", \"s\"]\r\n  list.each do |l|\r\n\tsp.write(l)\r\n\tsleep wait_time\r\n  end\r\nend\r\n```\r\nAfter this when I read about the five ways to run a mruby program and tried the first one with mruby compiler for running pure ruby code like \"mruby serialport.rb\" , I get the error like this \r\n```\r\n\t[0] ../test/serialport.rb:1\r\n../test/serialport.rb:1: undefined method 'assert' for main (NoMethodError)\r\n```\r\nI have been following so many forums for this. If anybody please explain me how can I achieve this, I will be obliged. :smiley:\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/28258613-running-the-example?utm_campaign=plugin&utm_content=tracker%2F669856&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F669856&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/monami-ya-mrb/mruby-serialport/issues/comments/157333462","html_url":"https://github.com/monami-ya-mrb/mruby-serialport/issues/1#issuecomment-157333462","issue_url":"https://api.github.com/repos/monami-ya-mrb/mruby-serialport/issues/1","id":157333462,"user":{"login":"tworitdash","id":5251113,"avatar_url":"https://avatars.githubusercontent.com/u/5251113?v=3","gravatar_id":"","url":"https://api.github.com/users/tworitdash","html_url":"https://github.com/tworitdash","followers_url":"https://api.github.com/users/tworitdash/followers","following_url":"https://api.github.com/users/tworitdash/following{/other_user}","gists_url":"https://api.github.com/users/tworitdash/gists{/gist_id}","starred_url":"https://api.github.com/users/tworitdash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tworitdash/subscriptions","organizations_url":"https://api.github.com/users/tworitdash/orgs","repos_url":"https://api.github.com/users/tworitdash/repos","events_url":"https://api.github.com/users/tworitdash/events{/privacy}","received_events_url":"https://api.github.com/users/tworitdash/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T10:44:38Z","updated_at":"2015-11-17T10:44:38Z","body":"Thanks a lot. :smiley: . It's fun working. "}}