{"id":390,"date":"2020-05-19T17:53:31","date_gmt":"2020-05-19T08:53:31","guid":{"rendered":"https:\/\/www.agtech.co.jp\/actian\/?page_id=390"},"modified":"2021-04-13T09:23:25","modified_gmt":"2021-04-13T00:23:25","slug":"codeproject02","status":"publish","type":"page","link":"https:\/\/www.agtech.co.jp\/actian\/zen\/reference\/codeproject02\/","title":{"rendered":"Actian Zen \/ CodeProject"},"content":{"rendered":"<div id=\"container\">\r\n\r\n\r\n <div id=\"main_contents_one\">\r\n  <h1 id=\"contents_h1\">CodeProject<\/h1>\r\n <\/div>\r\n \r\n  <div id=\"main_contents_right\">\r\n\r\n  <br>\r\n\r\n<div class=\"note\"> \r\n  \r\n   <p><span class=\"gray\">\uff08\u3054\u6848\u5185\uff09<\/span><br>\r\n   CodeProject \u306f\u3001CodeProject \u304c\u6709\u7528\u3067\u3001\u958b\u767a\u8005\u306b\u3068\u3063\u3066\u4fa1\u5024\u304c\u3042\u308b\u3068\u8003\u3048\u3089\u308c\u305f\u88fd\u54c1\u304a\u3088\u3073\u30b5\u30fc\u30d3\u30b9\u306b\u95a2\u3059\u308b\u60c5\u5831\u3092\u63d0\u4f9b\u3059\u308b\u3053\u3068\u3092\u76ee\u7684\u306b\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30b5\u30a4\u30c8\u3067\u3059\u3002<br>\r\n<br>\r\n\u3053\u3053\u3067\u306f\u3001Actian \u88fd\u54c1\u306b\u95a2\u9023\u3057\u305f\u516c\u958b\u60c5\u5831\u306e\u4e00\u90e8\u3092\u304a\u77e5\u3089\u305b\u3057\u3066\u304a\u308a\u307e\u3059\u3002<br>\r\n\u306a\u304a\u3001\u304a\u77e5\u3089\u305b\u3057\u3066\u3044\u308b\u60c5\u5831\u306f\u3001\u3059\u3079\u3066 CodeProject \u306b\u8457\u4f5c\u6a29\u7b49\u3001\u5e30\u5c5e\u3057\u3066\u3044\u307e\u3059\u3002\u672c\u30b5\u30a4\u30c8\u306f\u3001\u63d0\u4f9b\u5143\u3088\u308a\u4e86\u627f\u3092\u5f97\u3066\u3001\u30a8\u30fc\u30b8\u30fc\u30c6\u30c3\u30af\u304c\u7ffb\u8a33\u3057\u3066\u3054\u7d39\u4ecb\u3057\u3066\u304a\u308a\u307e\u3059\u3002\u8a18\u8f09\u60c5\u5831\u306e\u3054\u5229\u7528\u306e\u969b\u306f\u3001\u30aa\u30ea\u30b8\u30ca\u30eb\u30b5\u30a4\u30c8\u3068\u3042\u308f\u305b\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002<\/p>\r\n<\/div>\r\n  \r\n  <h3 class=\"h3_bar\">Actian Zen \u3068 Python \u3092\u4f7f\u7528\u3057\u305f\u7d44\u307f\u8fbc\u307f IoT \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9<\/h3>\r\n  \r\n \r\n  <table class=\"base_tbl_nbr\">\r\n   <tbody><tr>\r\n    <td><img loading=\"lazy\" src=\"\/img\/deco2.jpg\" width=\"70\" height=\"auto\"><\/td>\r\n    <td>\r\n    <p>Ryan Peden<br>\r\n\t\tSoftware Developer CodeProject<br>\r\n\t\tCanada<br>\r\n\t\t12 June 2019\r\n<br>\r\n\t\t<\/p><ul class=\"base_li\">\r\n\t\t\t<li><a href=\"https:\/\/www.codeproject.com\/Articles\/5093017\/Embedded-IoT-Databases-with-Actian-Zen-and-Pytho-2\" target=\"_blank\" rel=\"noopener noreferrer\">\u30aa\u30ea\u30b8\u30ca\u30eb\u30b5\u30a4\u30c8<\/a><\/li>\r\n  <\/ul>\r\n\r\n<p><\/p><\/td>\r\n   <\/tr>\r\n  <\/tbody><\/table>\r\n  <br>\r\n  <p>\u7d44\u307f\u8fbc\u307f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3001Actian Zen \u3092\u4f7f\u3063\u3066 Raspberry Pi \u306b\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3057\u3066\u51e6\u7406\u3059\u308b\u65b9\u6cd5\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002<br>\r\n<br>\r\n\r\n\u5f53\u8a18\u4e8b\u306f\u3001CodeProject \u306b\u304a\u3044\u3066\u30b9\u30dd\u30f3\u30b5\u30fc\u5411\u3051\u306b\u63d0\u4f9b\u3059\u308b\u300cProduct Showcase\u300d\u30bb\u30af\u30b7\u30e7\u30f3\u306b\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u8a18\u4e8b\u306f\u3001\u88fd\u54c1\u304a\u3088\u3073\u30b5\u30fc\u30d3\u30b9\u306b\u95a2\u3057\u3066\u3001\u958b\u767a\u8005\u5411\u3051\u306b\u6709\u76ca\u3068\u8003\u3048\u3089\u308c\u308b\u60c5\u5831\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\r\n<\/p>\r\n\t\r\n<br>\r\n\r\n\t<h4 class=\"headline06\">\u306f\u3058\u3081\u306b<\/h4>\r\n\t\r\n\t<p>\u304b\u3064\u3066\u3001\u7d44\u307f\u8fbc\u307f\u30b3\u30f3\u30d4\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u306f\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u958b\u767a\u306e\u4e16\u754c\u3067\u306f\u5c0f\u3055\u306a\u30cb\u30c3\u30c1\u5206\u91ce\u3067\u3057\u305f\u3002\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u306f\u9ad8\u4fa1\u3067\u3001\u5165\u624b\u304c\u96e3\u3057\u304f\u3001\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3092\u4f5c\u6210\u3059\u308b\u306e\u306f\u305a\u3063\u3068\u56f0\u96e3\u3067\u3057\u305f\u3002\u3053\u306e\u72b6\u6cc1\u306f\u5e78\u3044\u306b\u3082\u5909\u308f\u308a\u3064\u3064\u3042\u308a\u307e\u3059\u3002Raspberry Pi \u306e\u3088\u3046\u306a\u5b89\u4fa1\u3067\u4f7f\u3044\u3084\u3059\u3044\u7d44\u307f\u8fbc\u307f\u30c7\u30d0\u30a4\u30b9\u306e\u767b\u5834\u306b\u3088\u308a\u3001IoT \u30b3\u30f3\u30d4\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u304c\u4e3b\u6d41\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br>\r\n<br>\r\n\t\tRaspberry Pi \u306e\u3088\u3046\u306a\u30df\u30cb \u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u306f\u3001Arduino \u3084 ESP32 \u3092\u30d9\u30fc\u30b9\u306b\u3057\u305f\u30c7\u30d0\u30a4\u30b9\u307b\u3069\u5c0f\u3055\u304f\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u305d\u306e\u30b5\u30a4\u30ba\u3084\u6d88\u8cbb\u96fb\u529b\u306f\u3001\u6c17\u8c61\u89b3\u6e2c\u6240\u306e\u3088\u3046\u306a\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2 \u30bd\u30ea\u30e5\u30fc\u30b7\u30e7\u30f3\u306b\u7d44\u307f\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u308b\u307b\u3069\u3001\u5341\u5206\u306b\u5c0f\u3055\u306a\u3082\u306e\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u3053\u3068\u3092\u5ff5\u982d\u306b\u7f6e\u304d\u306a\u304c\u3089\u3001\u7d44\u307f\u8fbc\u307f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3001Actian Zen \u3092\u4f7f\u3063\u3066 Raspberry Pi \u306b\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3057\u3066\u51e6\u7406\u3059\u308b\u65b9\u6cd5\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002<br>\r\n\r\n<\/p>\r\n\t\r\n\t<h4 class=\"headline06\">\u7d44\u307f\u8fbc\u307f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f7f\u7528\u3059\u308b\u7406\u7531<\/h4>\r\n\t\r\n\t<p>Raspberry Pi \u306e\u3088\u3046\u306a\u7d44\u307f\u8fbc\u307f\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u306f\u3001\u3055\u307e\u3056\u307e\u306a\u30bb\u30f3\u30b5\u30fc\u3068\u901a\u4fe1\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u5834\u5408\u3001\u30bb\u30f3\u30b5\u30fc\u3068\u306f\u3001\u6c17\u6e29\u3001\u6e7f\u5ea6\u3001\u98a8\u901f\u3001\u5149\u6e90\u30ec\u30d9\u30eb\u3001\u5fc3\u62cd\u3001\u904b\u52d5\u3001\u52a0\u901f\u5ea6\u3001\u3055\u3089\u306b\u306f\u9178\u7d20\u3084\u4e8c\u9178\u5316\u70ad\u7d20\u306a\u3069\u306e\u6c17\u4f53\u306e\u30ec\u30d9\u30eb\u306e\u3088\u3046\u306a\u3082\u306e\u3092\u6e2c\u5b9a\u3067\u304d\u308b\u30bb\u30f3\u30b5\u30fc\u3067\u3059\u3002<br>\r\n<br>\r\n\t\t\u7d44\u307f\u8fbc\u307f\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u306f\u3001\u30bb\u30f3\u30b5\u30fc\u3092\u7d99\u7d9a\u7684\u306b\u76e3\u8996\u3059\u308b\u3068\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u751f\u6210\u3057\u307e\u3059\u3002\u6c17\u6e29\u3001\u98a8\u901f\u3001\u6e7f\u5ea6\u3001\u6c17\u5727\u3092\u6e2c\u5b9a\u3057\u3066\u3044\u308b\u6c17\u8c61\u89b3\u6e2c\u6240\u304c\u3042\u308b\u3068\u3057\u307e\u3059\u300230 \u79d2\u3054\u3068\u306b\u30bb\u30f3\u30b5\u30fc\u304b\u3089\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u53d6\u308b\u5834\u5408\u306f\u3001\u6bce\u65e5\u4f55\u5343\u3082\u306e\u6e2c\u5b9a\u5024\u3092\u8a18\u9332\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\r\n\t\t<br>\r\n<br>\r\n\t\t\u30bb\u30f3\u30b5\u30fc\u306e\u8aad\u307f\u53d6\u308a\u5024\u3059\u3079\u3066\u3092\u51e6\u7406\u306e\u305f\u3081\u30bb\u30f3\u30c8\u30e9\u30eb \u30b5\u30fc\u30d0\u30fc\u306b\u8ee2\u9001\u3059\u308b\u3088\u3046\u3001\u7d44\u307f\u8fbc\u307f\u30c7\u30d0\u30a4\u30b9\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u304c\u3001\u305d\u3046\u3057\u305f\u304f\u306a\u3044\u5834\u5408\u3082\u3042\u308a\u307e\u3059\u3002\u67b6\u7a7a\u3067\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u3053\u306e\u3088\u3046\u306a\u6c17\u8c61\u89b3\u6e2c\u6240\u3067\u4f7f\u7528\u3055\u308c\u308b\u7d44\u307f\u8fbc\u307f\u30c7\u30d0\u30a4\u30b9\u306f\u3001\u4f4e\u901f\u3067\u4fe1\u983c\u6027\u304c\u4f4e\u304f\u9ad8\u4fa1\u306a\u30e2\u30d0\u30a4\u30eb \u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u63a5\u7d9a\u3092\u4f7f\u3063\u3066\u3001\u9060\u9694\u5730\u3067\u7a3c\u50cd\u3057\u3066\u3044\u308b\u5834\u5408\u304c\u3088\u304f\u3042\u308a\u307e\u3059\u3002<br>\r\n<br>\r\n\t\t\u30c7\u30d0\u30a4\u30b9\u304c\u3042\u307e\u308a\u591a\u304f\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u5e2f\u57df\u5e45\u3092\u4f7f\u7528\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304c\u30c0\u30a6\u30f3\u3057\u305f\u5834\u5408\u3067\u3082\u5f15\u304d\u7d9a\u304d\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u306b\u306f\u3001\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3057\u3066\u96c6\u7d04\u3059\u308b\u65b9\u6cd5\u304c\u5fc5\u8981\u3067\u3059\u3002\u305d\u3053\u3067\u3001Actian Zen \u306e\u767b\u5834\u3067\u3059\u3002Raspberry Pi \u4e0a\u306b Zen \u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u3001Python \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089 Raspberry Pi \u306b\u30bb\u30f3\u30b5\u30fc\u306e\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3059\u308b\u624b\u9806\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br>\r\n\r\n<br>\r\n\r\n<\/p>\r\n\t<h4 class=\"headline06\">\u524d\u63d0\u6761\u4ef6<\/h4>\r\n\t\r\n\t<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3053\u308c\u4ee5\u964d\u3001\u4e0b\u8a18\u3092\u524d\u63d0\u3068\u3057\u3066\u9032\u3081\u307e\u3059\u3002<br>\r\n\t<\/p>\r\n\r\n<ul class=\"base_li\">\r\n\t<li>Raspbian Linux \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u7a3c\u50cd\u3057\u3066\u3044\u308b Raspberry Pi \u3092\u6301\u3063\u3066\u3044\u308b\u3002<\/li>\r\n\t<li>Linux \u30bf\u30fc\u30df\u30ca\u30eb\u3092\u4f7f\u7528\u3067\u304d\u308b\u3002\u305f\u3060\u3057\u3001\u30a8\u30ad\u30b9\u30d1\u30fc\u30c8\u3067\u3042\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u5b9f\u884c\u3059\u308b\u30b3\u30de\u30f3\u30c9\u306f\u3053\u3061\u3089\u304b\u3089\u8a73\u7d30\u306b\u6307\u793a\u3059\u308b\u304b\u3089\u3067\u3059\u3002<\/li>\r\n\t<li>SELECT \u3084 INSERT \u306a\u3069\u306e\u57fa\u672c\u7684\u306a SQL \u30b3\u30de\u30f3\u30c9\u3092\u7406\u89e3\u3057\u3066\u3044\u308b\u3002<\/li>\r\n  <\/ul>\r\n\t<br>\r\n\r\n  <div class=\"goto_top\"><a href=\"#top\">\u30da\u30fc\u30b8\u306eTOP\u3078\u623b\u308b<\/a><\/div>\r\n\t<h4 class=\"headline06\">\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h4>\r\n\t\r\n\t<p>\u6700\u521d\u306b\u3001Actian Zen \u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002Pi \u306e Web \u30d6\u30e9\u30a6\u30b6\u30fc\u3092\u4f7f\u3063\u3066\u76f4\u63a5\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u3082\u3001Zen \u3092\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc\u306b\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3001USB \u30d5\u30e9\u30c3\u30b7\u30e5 \u30c9\u30e9\u30a4\u30d6\u3092\u4f7f\u3063\u3066 Pi \u306b\u8ee2\u9001\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<br>\r\n<br>\r\n\t  <a href=\"\/contact\/form_after\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u300eActian Zen Edge Raspbian Linux \u8a55\u4fa1\/\u958b\u767a\u7248 \u304a\u7533\u3057\u8fbc\u307f\u300f<\/a>\u30da\u30fc\u30b8\u3067\u8a55\u4fa1\/\u958b\u767a\u7248\u306e\u304a\u7533\u3057\u8fbc\u307f\u3092\u884c\u3044\u307e\u3059\u3002<br>\r\n\t\t\u8fd4\u4fe1\u30e1\u30fc\u30eb\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u624b\u9806\u306b\u5f93\u3063\u3066\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30da\u30fc\u30b8\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u307e\u3059\u3002<br>\r\n\t\tEULA \u3092\u78ba\u8a8d\u5f8c\u3001[Zen Edge \u30d5\u30a1\u30a4\u30eb\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9] \u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<br>\r\n\t\tZen-IoT-Community.jajp-linux-xx.xx-xxx.xxx.armhf.tar.gz \u30d5\u30a1\u30a4\u30eb\u304c\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3055\u308c\u307e\u3059\u3002<br>\r\n\t  <br>\r\n\r\n\r\n\t\t\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u304c\u5b8c\u4e86\u3057\u305f\u3089\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u958b\u304d\u307e\u3059\u3002Raspbian \u3067\u3053\u308c\u3092\u884c\u3046\u306b\u306f\u3001\u753b\u9762\u4e0a\u90e8\u306e\u8fd1\u304f\u306b\u3042\u308b<img loading=\"lazy\" src=\"..\/..\/..\/..\/img\/Actian_CodeProject_2-2.png\" width=\"32\" height=\"23\" alt=\"\"> \u30a2\u30a4\u30b3\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<br>\r\n<br>\r\n\t\t\u6b21\u306b\u3001Actian Zen \u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u307e\u3059\u3002Actian Zen \u3092 Pi \u306b\u76f4\u63a5\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u5834\u5408\u306b\u5f53\u8a72\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3059\u308b\u306b\u306f\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\r\n\r\n<br>\r\n <div class=\"note\" style=\"background-color: bisque;border:solid 0px\">\r\n  <pre>cd ~\/Downloads<\/pre>\r\n\r\n <\/div>\r\n\t\r\n  <br>\r\n\t<p>\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066 Zen \u3092\u89e3\u51cd\u3057\u307e\u3059\u3002<\/p>\r\n<br>\r\n <div class=\"note\" style=\"background-color: bisque;border:solid 0px\">\r\n  <pre>sudo tar -C \/usr\/local -xvf Zen-IoT-Community.jajp-linux-xx.xx-xxx.xxx.armhf.tar.gz<\/pre>\r\n <\/div>\r\n\t\t <p>\u203b\u4e0a\u8a18\u306exx.xx-xxx.xxx\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u5408\u308f\u305b\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\r\n\t\r\n\r\n  <br>\r\n\t<p>Zen \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306f\u3001Zen \u304c \/usr\/local \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u3042\u308b\u3082\u306e\u3068\u60f3\u5b9a\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u3053\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u89e3\u51cd\u3057\u307e\u3057\u305f\u3002\u6b21\u306b\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u9806\u756a\u306b\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\r\n<br>\r\n\t\r\n <div class=\"note\" style=\"background-color: bisque;border:solid 0px\">\r\n  <pre>sudo apt install unixodbc\r\ncd \/usr\/local\/psql\/etc\r\nsudo .\/preinstall.sh\r\nsudo .\/postinstall.sh<\/pre>\r\n <\/div>\r\n\t\r\n  <br>\r\n\t<p>\u307e\u305a\u3001unixodbc \u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002unixodbc \u306f\u3001UNIX \u304a\u3088\u3073 UNIX \u30e9\u30a4\u30af\u306a\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0 \u30b7\u30b9\u30c6\u30e0\u7528\u306e Open Database Connectivity\uff08ODBC\uff09\u30c9\u30e9\u30a4\u30d0\u30fc\u3067\u3059\u3002ODBC \u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3059\u308b\u305f\u3081\u306e\u6a19\u6e96\u7684\u306a\u65b9\u6cd5\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001ODBC \u3092\u4f7f\u3063\u3066\u3001Python \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089 Zen \u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<br>\r\n<br>\r\n\t\t\u6b21\u306b\u3001Zen \u3092\u89e3\u51cd\u3057\u305f psql \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u307e\u3059\u3002\u6700\u5f8c\u306b\u3001Zen \u306e preinstall \u30b9\u30af\u30ea\u30d7\u30c8\u3068 postinstall \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002preinstall \u306f\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b Zen \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u8981\u4ef6\u3092\u30b7\u30b9\u30c6\u30e0\u304c\u6e80\u305f\u3057\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002Zen \u306e Raspbian \u30d3\u30eb\u30c9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u3044\u308b\u5834\u5408\u306b\u306f\u3001\u554f\u984c\u306f\u767a\u751f\u3057\u307e\u305b\u3093\u3002postinstall \u306b\u3088\u308a\u3001\u9b54\u6cd5\u304c\u639b\u3051\u3089\u308c\u307e\u3059\u3002\u3064\u307e\u308a\u3001\u65b0\u3057\u3044 psql \u30e6\u30fc\u30b6\u30fc\u306e\u4f5c\u6210\u3001Zen \u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3001Zen \u30c7\u30fc\u30e2\u30f3\u306e\u8d77\u52d5\u3001DEMODATA \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4f5c\u6210\u3001\u305d\u3057\u3066\u30c7\u30e2 \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u306e\u30b5\u30f3\u30d7\u30eb \u30c7\u30fc\u30bf\u306e\u6295\u5165\u304c\u3059\u3079\u3066\u884c\u308f\u308c\u307e\u3059\u3002<br>\r\n<br>\r\n\t\t\u6b21\u306b\u3001Zen \u3092 ODBC \u7d4c\u7531\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306b\u3001\u30b9\u30fc\u30d1\u30fc\u30e6\u30fc\u30b6\u30fc\u3068\u3057\u3066\u3055\u3089\u306b\u3044\u304f\u3064\u304b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u6ce8\u610f\uff1a\u30b9\u30fc\u30d1\u30fc\u30e6\u30fc\u30b6\u30fc\u3068\u3057\u3066\u5b9f\u884c\u3059\u308b\u3053\u3068\u306b\u306f\u5371\u967a\u304c\u4f34\u3044\u307e\u3059\u3002\u30d5\u30a1\u30a4\u30eb \u30b7\u30b9\u30c6\u30e0\u5168\u4f53\u3092\u524a\u9664\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3092\u8aa4\u3063\u3066\u5b9f\u884c\u3057\u305f\u5834\u5408\u3067\u3082\u3001Raspbian \u306f\u8b66\u544a\u3092\u767a\u884c\u3059\u308b\u3053\u3068\u306a\u304f\u524a\u9664\u3092\u884c\u3044\u307e\u3059\u3002\u5165\u529b\u3057\u305f\u30b3\u30de\u30f3\u30c9\u306f\u3001\u5b9f\u884c\u3059\u308b\u524d\u306b\u5fc5\u305a\u518d\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br>\r\n\r\n<\/p>\r\n<br>\r\n <div class=\"note\" style=\"background-color: bisque;border:solid 0px\">\r\n  <pre>sudo su\r\ncd \/etc\r\ncat \/usr\/local\/psql\/etc\/odbc.ini &gt;&gt; .\/odbc.ini\r\ncat \/usr\/local\/psql\/etc\/odbcinst.ini &gt;&gt; .\/odbcinst.ini\r\nexit<\/pre>\r\n <\/div>\r\n\t\r\n\t\r\n  <br>\r\n\t<p>\u4e0a\u8a18\u3067\u884c\u3063\u305f\u3053\u3068\u306f\u3001Zen \u306e ODBC \u69cb\u6210\u30c7\u30fc\u30bf\u3092\u30b7\u30b9\u30c6\u30e0\u5168\u4f53\u306e ODBC \u69cb\u6210\u30d5\u30a1\u30a4\u30eb\u306b\u8ffd\u52a0\u3057\u305f\u3053\u3068\u306b\u307b\u304b\u306a\u308a\u307e\u305b\u3093\u3002\u69cb\u6210\u3092\u30b3\u30d4\u30fc\u3059\u308b\u3053\u3068\u3067\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c ODBC \u7d4c\u7531\u3067 Zen \u3092\u7279\u5b9a\u3057\u3066\u63a5\u7d9a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u6700\u5f8c\u306e exit \u30b3\u30de\u30f3\u30c9\u306b\u3088\u308a\u3001\u3042\u306a\u305f\u306f\u30b9\u30fc\u30d1\u30fc\u30e6\u30fc\u30b6\u30fc\u3067\u306f\u306a\u304f\u306a\u308a\u307e\u3059\u3002<br>\r\n<br>\r\n\t\t\u6b21\u306e\u3082\u3046 1 \u3064\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\r\n<\/p>\r\n<br>\r\n <div class=\"note\" style=\"background-color: bisque;border:solid 0px\">\r\n  <pre>cat \/home\/psql\/.bashrc &gt;&gt; ~\/.bashrc<\/pre>\r\n <\/div>\r\n\t\r\n  <br>\r\n\t<p>\u6700\u5f8c\u306b\u3001psql \u30e6\u30fc\u30b6\u30fc\u306e Bash \u69cb\u6210\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30e6\u30fc\u30b6\u30fc\u3068\u3057\u3066\u306e\u81ea\u5206\u306e Bash \u69cb\u6210\u30d5\u30a1\u30a4\u30eb\u306b\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u30e9\u30a4\u30d6\u30e9\u30ea \u30ed\u30fc\u30c9 \u30d1\u30b9\u306b Zen \u306e\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002\u3053\u306e\u624b\u9806\u304c\u306a\u3044\u3068\u3001Python \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f Zen \u306b\u63a5\u7d9a\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u7279\u5b9a\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002<br>\r\n\r\n<\/p>\r\n\t\r\n\t<h4 class=\"headline06\">Python \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<\/h4>\r\n\t\r\n\t<p>15 \u79d2\u3054\u3068\u306b CPU \u306e\u6e29\u5ea6\u30c7\u30fc\u30bf\u3092\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\u3057\u3066 Zen \u306b\u66f8\u304d\u8fbc\u3080 Python 3 \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001Zen \u304b\u3089\u96c6\u8a08\u30c7\u30fc\u30bf\u3092\u7167\u4f1a\u3059\u308b\u65b9\u6cd5\u3082\u793a\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u30c7\u30fc\u30bf\u3092\u30bb\u30f3\u30c8\u30e9\u30eb \u30b5\u30fc\u30d0\u30fc\u306b\u9001\u4fe1\u3059\u308b\u6e96\u5099\u3068\u3057\u3066\u3001\u307e\u3055\u306b\u3042\u306a\u305f\u304c\u3084\u308a\u305f\u3044\u3053\u3068\u3067\u3059\u3002<br>\r\n<br>\r\n\t\t\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u4f5c\u6210\u3092\u958b\u59cb\u3059\u308b\u524d\u306b\u3001Python \u304c ODBC \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br>\r\n\r\n<\/p>\r\n\t\r\n<br>\r\n\t\r\n <div class=\"note\" style=\"background-color: bisque;border:solid 0px\">\r\n  <pre>sudo apt install python3-pyodbc<\/pre>\r\n <\/div>\r\n\t\r\n  <br>\r\n\t<p>\u3053\u306e\u30b3\u30de\u30f3\u30c9\u306b\u3088\u308a\u3001pyodbc \u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30d3\u30eb\u30c9\u6e08\u307f\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u305f\u3089\u3001\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3059\u308b\u6e96\u5099\u304c\u5b8c\u4e86\u3067\u3059\u3002<br>\r\n<br>\r\n\t\t\u306f\u3058\u3081\u306b\u3001\u4efb\u610f\u306e\u30c6\u30ad\u30b9\u30c8 \u30a8\u30c7\u30a3\u30bf\u30fc\u3092\u958b\u304d\u307e\u3059\u3002Raspbian \u306b\u306f\u3001\u8efd\u91cf\u306e Python IDE \u3067\u3042\u308b Thonny \u304c\u540c\u68b1\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u4f55\u3092\u4f7f\u3046\u3079\u304d\u304b\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f Thonny \u3092\u9078\u629e\u3059\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u3069\u306e\u30a8\u30c7\u30a3\u30bf\u30fc\u304c\u4f7f\u7528\u3055\u308c\u308b\u304b\u306b\u3064\u3044\u3066\u306f\u60f3\u5b9a\u3057\u3066\u3044\u307e\u305b\u3093\u306e\u3067\u3001Thonny \u4ee5\u5916\u306e\u30a8\u30c7\u30a3\u30bf\u30fc\u3067\u3082\u81ea\u7531\u306b\u3054\u4f7f\u7528\u3044\u305f\u3060\u3044\u3066\u69cb\u3044\u307e\u305b\u3093\u3002<br>\r\n<br>\r\n\t\t\u6b21\u306b\u3001\u65b0\u3057\u3044\u30a2\u30d7\u30ea\u7528\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u79c1\u306f\u901a\u5e38\u3001\u30db\u30fc\u30e0 \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4e0b\u306b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8 \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3001\u305d\u3053\u306b\u81ea\u5206\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4fdd\u5b58\u3057\u3066\u3044\u307e\u3059\u3002\u305d\u3046\u3059\u308b\u65b9\u6cd5\u3092\u4ee5\u4e0b\u306b\u793a\u3057\u307e\u3059\u3002<br>\r\n\r\n<\/p>\r\n<br>\r\n <div class=\"note\" style=\"background-color: bisque;border:solid 0px\">\r\n  <pre>mkdir ~\/projects\r\nmkdir ~\/projects\/zen-iot\r\ncd ~\/projects\/zen-iot<\/pre>\r\n <\/div>\r\n  <br>\r\n\r\n  <br>\r\n\t<p>\u4e0a\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u7528\u306e\u65b0\u3057\u3044\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3066\u304b\u3089\u3001\u73fe\u5728\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u65b0\u3057\u3044\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u30bf\u30fc\u30df\u30ca\u30eb \u30a6\u30a3\u30f3\u30c9\u30a6\u306f\u958b\u3044\u305f\u307e\u307e\u306b\u3057\u3066\u304a\u304d\u307e\u3059\u3002\u3053\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u306f\u3001\u30a2\u30d7\u30ea\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3059\u308b\u304b\u3089\u3067\u3059\u3002<br>\r\n\t\t<br>\r\n\t\t\u30c6\u30ad\u30b9\u30c8 \u30a8\u30c7\u30a3\u30bf\u30fc\u3067\u65b0\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001setup.py \u3068\u3057\u3066\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u4fdd\u5b58\u3057\u307e\u3059\u3002\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<br>\r\n\r\n<\/p>\r\n<br>\r\n <div class=\"note\" style=\"background-color: bisque;border:solid 0px\">\r\n  <pre>import pyodbc\r\n\r\nconn_str = \"Driver={Pervasive ODBC Interface};server=localhost;DBQ=demodata\"\r\ndb = pyodbc.connect(conn_str)\r\nc = db.cursor()\r\n\r\nprint(\"Setting up database...\")\r\nc.execute(\"DROP TABLE IF EXISTS cpu_data\")\r\nc.execute(\"CREATE TABLE cpu_data (id identity, timestamp bigint, temperature real)\")\r\nc.execute(\"CREATE INDEX cpu_data_time on cpu_data (timestamp)\")<\/pre>\r\n <\/div>\r\n\t\r\n  <br>\r\n\t<p>\u307e\u305a pyodbc \u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002\u6b21\u306b\u3001ODBC \u63a5\u7d9a\u6587\u5b57\u5217\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002ODBC \u306e\u5168\u5bb9\u306f\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306e\u7bc4\u56f2\u3092\u8d85\u3048\u3066\u3044\u307e\u3059\u304c\u3001OBDC \u3068 Zen \u306b\u3064\u3044\u3066\u306f\u3053\u3053\u3067\u8aad\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\r\nZen \u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u4e2d\u306b\u4f5c\u6210\u3057\u305f\u65e2\u5b58\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9 demodata \u304c\u3001\u63a5\u7d9a\u6587\u5b57\u5217\u306e\u4e2d\u3067\u4f7f\u7528\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u306b\u6c17\u3065\u304b\u308c\u308b\u3067\u3057\u3087\u3046\u3002\u30d7\u30ed\u30c0\u30af\u30b7\u30e7\u30f3 \u30a2\u30d7\u30ea\u3067\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u4f5c\u6210\u3057\u305f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br>\r\n<br>\r\n\t\t\u6b21\u306b\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3057\u3066 3 \u3064\u306e SQL \u30b3\u30de\u30f3\u30c9\u3092\u767a\u884c\u3057\u307e\u3059\u3002\u30c6\u30fc\u30d6\u30eb\u304c\u65e2\u306b\u5b58\u5728\u3059\u308b\u5834\u5408\u306b\u524a\u9664\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3001\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3001\u304a\u3088\u3073\u30c6\u30fc\u30d6\u30eb\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u8ffd\u52a0\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\u306b\u8a2d\u5b9a\u3059\u308b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u91cd\u8981\u3067\u3059\u3002\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\u306b\u3088\u3063\u3066\u6c17\u6e29\u3092\u7167\u4f1a\u3059\u308b\u305f\u3081\u3068\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306b\u3088\u3063\u3066\u691c\u7d22\u304c\u9ad8\u901f\u306b\u306a\u308b\u305f\u3081\u3067\u3059\u3002<br>\r\n<br>\r\n\t\t\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\u3092\u683c\u7d0d\u3059\u308b\u306e\u306b\u3001SQL \u306e date \u578b\u3067\u306a\u304f bigint \u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u3046\u3059\u308b\u306e\u306f\u3001\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\u3092 UNIX \u6642\u523b\u3068\u3057\u3066\u683c\u7d0d\u3059\u308b\u305f\u3081\u3067\u3059\u3002<br>\r\n<br>\r\n\t\t\u6b21\u306b\u3001\u30a2\u30d7\u30ea \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b write.py \u3068\u3044\u3046\u540d\u524d\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u6b21\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br>\r\n\r\n<\/p>\r\n\t\r\n<br>\r\n\t\r\n <div class=\"note\" style=\"background-color: bisque;border:solid 0px\">\r\n\t <pre>import time\r\nimport sys\r\nimport subprocess\r\nimport pyodbc\r\n\t \r\ndef get_cpu_temperature():\r\n  output = subprocess.check_output([\"cat\",\"\/sys\/class\/thermal\/thermal_zone0\/temp\"])\r\n  temp_value = float(output) \/ 1000\r\n  return temp_value\r\n\r\ndef main():\r\n  conn_str = \"Driver={Pervasive ODBC Interface};server=localhost;DBQ=demodata\"\r\n  db = pyodbc.connect(conn_str)\r\n  c = db.cursor()\r\n  insert_command = \"\"\"INSERT INTO cpu_data VALUES (0, ?, ?)\"\"\"\r\n\r\n  while True:\r\n    current_temp = get_cpu_temperature()\r\n    print(\"Saving temperature: {0}\".format(current_temp))\r\n    timestamp = int(time.time())\r\n    c.execute(insert_command, (timestamp, current_temp))\r\n    c.commit()\r\n    c.execute(\"SELECT COUNT(*) FROM cpu_data\")\r\n    row = c.fetchone()\r\n    if row:\r\n      print('Total temperature records:', row[0])\r\n    time.sleep(30)\r\n\r\n    \r\n  return 0\r\n   \r\nif __name__ == \"__main__\":\r\n  sys.exit(main())<\/pre>\r\n\t \r\n <\/div>\r\n\t\t\r\n  <br>\r\n\t<p>\u307e\u305a\u3001pyodbc \u3068 Python \u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u3044\u304f\u3064\u304b\u306e\u90e8\u5206\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002<br>\r\n\t\t<br>\r\n\t\t\u6b21\u306b\u3001CPU \u306e\u6e29\u5ea6\u3092\u8aad\u307f\u53d6\u308b\u95a2\u6570\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002Linux \u306f\u30b7\u30b9\u30c6\u30e0\u60c5\u5831\u3092\u30d5\u30a1\u30a4\u30eb \u30b7\u30b9\u30c6\u30e0\u306e\u4e00\u90e8\u3068\u3057\u3066\u516c\u958b\u3059\u308b\u306e\u3067\u3001\/sys\/class\/thermal\/thermal_zone0\/temp \u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u53d6\u308b\u305f\u3081\u306b cat \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u3001\u73fe\u5728\u306e CPU \u6e29\u5ea6\u304c 1000 \u5206\u306e 1\u2103\u5358\u4f4d\u3067\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002\u2103\u306b\u5909\u63db\u3059\u308b\u305f\u3081\u306b\u30011000 \u3067\u9664\u7b97\u3057\u3066\u3044\u307e\u3059\u3002<br>\r\n<br>\r\n\t\t\u6b21\u306b\u3001main \u95a2\u6570\u306b\u3042\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u6838\u5fc3\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002\u63a5\u7d9a\u6587\u5b57\u5217\u3068\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u306f setup.py \u5185\u306b\u3042\u308b\u3082\u306e\u3068\u540c\u3058\u3067\u3059\u3002\u6b21\u306b\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u65b0\u3057\u3044\u30ec\u30b3\u30fc\u30c9\u3092\u633f\u5165\u3059\u308b\u305f\u3081\u306e SQL \u30b3\u30de\u30f3\u30c9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br>\r\n<br>\r\n\t\t\u6700\u5f8c\u306b\u3001\u300c\u73fe\u5728\u306e\u6e29\u5ea6\u3092\u53d6\u5f97\u3057\u3001\u305d\u308c\u3092\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u66f8\u304d\u8fbc\u3093\u3067\u304b\u3089 30 \u79d2\u5f85\u6a5f\u3059\u308b\u300d\u3068\u3044\u3046\u30eb\u30fc\u30d7\u3092\u958b\u59cb\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u300130 \u79d2\u6bce\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b CPU \u306e\u6e29\u5ea6\u3092\u8a18\u9332\u3059\u308b\u3001\u6c38\u4e45\u306b\u5b9f\u884c\u3055\u308c\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u5f97\u3089\u308c\u307e\u3059\u3002\u5b9f\u7a3c\u50cd\u306e IoT Linux \u30a2\u30d7\u30ea\u3067\u306f\u3001\u901a\u5e38\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092 systemd \u30b5\u30fc\u30d3\u30b9\u3068\u3057\u3066\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001IoT \u30c7\u30d0\u30a4\u30b9\u304c\u8d77\u52d5\u3059\u308c\u3070\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u81ea\u52d5\u7684\u306b\u8d77\u52d5\u3057\u3001IoT \u30c7\u30d0\u30a4\u30b9\u304c\u30af\u30e9\u30c3\u30b7\u30e5\u3059\u308c\u3070\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u81ea\u52d5\u7684\u306b\u518d\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u3059\u308b\u8a2d\u5b9a\u3092\u7c21\u5358\u306b\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br>\r\n<br>\r\n\t\t\u8ffd\u52a0\u3059\u308b\u30b3\u30fc\u30c9\u304c\u3082\u3046 1 \u3064\u3042\u308a\u307e\u3059\u3002\u30a2\u30d7\u30ea \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b read.py \u3068\u3044\u3046\u540d\u524d\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u6b21\u306e\u30b3\u30fc\u30c9\u3092\u5165\u529b\u3057\u307e\u3059\u3002<br>\r\n\r\n<\/p>\r\n<br>\r\n <div class=\"note\" style=\"background-color: bisque;border:solid 0px\">\r\n  <pre>import pyodbc\r\nimport time\r\n\r\nconn_str = \"Driver={Pervasive ODBC Interface};server=localhost;DBQ=demodata\"\r\ndb = pyodbc.connect(conn_str)\r\nc = db.cursor()\r\n\r\nfive_mins_ago = int(time.time()) - 300\r\nquery = \"SELECT AVG (temperature) FROM cpu_data WHERE timestamp &gt; ?\"\r\nresult = c.execute(query, (five_mins_ago,))\r\nrow = result.fetchone()\r\n\r\nif row:\r\n    print(\"Average temperature over past 5 minutes: {0}\".format(row[0]))<\/pre>\r\n <\/div>\r\n\t\r\n  <br>\r\n\r\n  <br>\r\n\t<p>\u3053\u3053\u3067\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3057\u30015 \u5206\u524d\u306e UNIX \u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\u3092\u8a08\u7b97\u3057\u3066\u304b\u3089\u3001\u904e\u53bb 5 \u5206\u9593\u306e\u5e73\u5747 CPU \u6e29\u5ea6\u3092\u30d5\u30a7\u30c3\u30c1\u3059\u308b\u305f\u3081\u306e SQL \u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u305d\u306e\u5f8c\u3001\u3053\u306e\u5024\u3092\u30bf\u30fc\u30df\u30ca\u30eb\u306b\u51fa\u529b\u3057\u307e\u3059\u3002<br>\r\n<br>\r\n\t\t\u5b9f\u969b\u306e IoT \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u3001\u3053\u306e\u30c7\u30fc\u30bf\u3092\u30af\u30e9\u30a6\u30c9\u307e\u305f\u306f\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8 \u30b5\u30fc\u30d0\u30fc\u306b\u9001\u4fe1\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3067\u3057\u3087\u3046\u3002\u5148\u306b\u8aac\u660e\u3057\u305f\u3088\u3046\u306b\u3001\u30c7\u30fc\u30bf\u3092\u96c6\u4e2d\u7ba1\u7406\u3067\u304d\u308b\u5834\u6240\u306b\u9001\u4fe1\u3059\u308b\u524d\u306b\u96c6\u8a08\u3057\u3066\u5fc5\u8981\u306a\u8a08\u7b97\u3092\u5b9f\u884c\u3067\u304d\u308b\u3053\u3068\u304c\u3001IoT \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067 Zen \u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u7406\u7531\u3067\u3059\u3002<br>\r\n<br>\r\n\t\t\u4f5c\u6210\u3057\u305f\u30a2\u30d7\u30ea\u3092\u5b9f\u884c\u3059\u308b\u306b\u306f\u3001\u30a2\u30d7\u30ea\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304b\u3089\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<br>\r\n\r\n<\/p>\r\n<br>\r\n\t\r\n <div class=\"note\" style=\"background-color: bisque;border:solid 0px\">\r\n  <pre>python3 setup.py\r\npython3 write.py\r\n<\/pre>\r\n <\/div>\r\n\t\r\n  <br>\t\r\n\t<p>\u3053\u308c\u3092 5 \uff5e 10 \u5206\u9593\u5b9f\u884c\u3057\u3066\u3001\u6e29\u5ea6\u30c7\u30fc\u30bf\u3092 Zen \u306b\u4fdd\u5b58\u3057\u307e\u3059\u3002\u305d\u306e\u5f8c\u3001Ctrl \u30ad\u30fc\u3092\u62bc\u3057\u306a\u304c\u3089 Z \u30ad\u30fc\u3092\u62bc\u3057\u3066\u30a2\u30d7\u30ea\u3092\u7d42\u4e86\u3057\u307e\u3059\u3002<br>\r\n<br>\r\n\t\t\u6700\u5f8c\u306b\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<br>\r\n\r\n<\/p>\r\n<br>\r\n <div class=\"note\" style=\"background-color: bisque;border:solid 0px\">\r\n  <pre>python3 read.py<\/pre>\r\n <\/div>\r\n\t\r\n  <br>\r\n\r\n  <br>\r\n\t<p>Raspberry Pi \u306e\u904e\u53bb 5 \u5206\u9593\u306e\u5e73\u5747 CPU \u6e29\u5ea6\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<br>\r\n<br>\r\n\t\t\u3053\u308c\u3067\u7a3c\u50cd\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002\u3088\u308a\u8907\u96d1\u306a\u30bb\u30f3\u30b5\u30fc \u30c7\u30fc\u30bf\u3092 Raspberry Pi \u306b\u4fdd\u5b58\u3057\u3066\u51e6\u7406\u3059\u308b\u306b\u306f\u3001Zen \u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3092\u691c\u8a0e\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3069\u3053\u304b\u3089\u59cb\u3081\u308c\u3070\u3088\u3044\u304b\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u5b89\u4fa1\u306a\u30bb\u30f3\u30b5\u30fc \u30ad\u30c3\u30c8\u304c\u6570\u591a\u304f\u5e02\u8ca9\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u9762\u767d\u3044\u30bb\u30f3\u30b5\u30fc\u304c\u8c4a\u5bcc\u306b\u3042\u308b\u306e\u3067\u3001\u304d\u3063\u3068\u7d20\u6674\u3089\u3057\u3044\u30a2\u30a4\u30c7\u30a2\u3092\u601d\u3044\u3064\u304f\u3053\u3068\u3067\u3057\u3087\u3046!<br>\r\n\r\n<\/p>\r\n\t<h4 class=\"headline06\">\u30e9\u30a4\u30bb\u30f3\u30b9<\/h4>\r\n\t\r\n\t<p>\u5f53\u8a18\u4e8b\u304a\u3088\u3073\u95a2\u9023\u3059\u308b\u30bd\u30fc\u30b9 \u30b3\u30fc\u30c9\u3068\u30d5\u30a1\u30a4\u30eb\u306f\u3001<a href=\"https:\/\/www.codeproject.com\/info\/cpol10.aspx\" target=\"_blank\" rel=\"noopener noreferrer\">The Code Project Open License (CPOL)<\/a> \u306b\u57fa\u3065\u3044\u3066\u30e9\u30a4\u30bb\u30f3\u30b9\u3055\u308c\u307e\u3059\u3002<\/p>\r\n  \r\n <\/div>\r\n\r\n<\/div>","protected":false},"excerpt":{"rendered":"CodeProject \uff08\u3054\u6848\u5185\uff09 CodeProject \u306f\u3001CodeProject \u304c\u6709\u7528\u3067\u3001\u958b\u767a\u8005\u306b\u3068\u3063\u3066\u4fa1\u5024\u304c\u3042\u308b\u3068\u8003\u3048\u3089\u308c\u305f\u88fd\u54c1\u304a\u3088\u3073\u30b5\u30fc\u30d3\u30b9\u306b\u95a2\u3059\u308b\u60c5\u5831\u3092\u63d0\u4f9b\u3059\u308b\u3053\u3068\u3092\u76ee\u7684\u306b\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30b5\u30a4\u30c8\u3067\u3059\u3002 \u3053\u3053\u3067 [&hellip;]","protected":false},"author":1,"featured_media":0,"parent":305,"menu_order":65,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.agtech.co.jp\/actian\/wp-json\/wp\/v2\/pages\/390"}],"collection":[{"href":"https:\/\/www.agtech.co.jp\/actian\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.agtech.co.jp\/actian\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.agtech.co.jp\/actian\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.agtech.co.jp\/actian\/wp-json\/wp\/v2\/comments?post=390"}],"version-history":[{"count":3,"href":"https:\/\/www.agtech.co.jp\/actian\/wp-json\/wp\/v2\/pages\/390\/revisions"}],"predecessor-version":[{"id":1667,"href":"https:\/\/www.agtech.co.jp\/actian\/wp-json\/wp\/v2\/pages\/390\/revisions\/1667"}],"up":[{"embeddable":true,"href":"https:\/\/www.agtech.co.jp\/actian\/wp-json\/wp\/v2\/pages\/305"}],"wp:attachment":[{"href":"https:\/\/www.agtech.co.jp\/actian\/wp-json\/wp\/v2\/media?parent=390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}