{"id":779,"date":"2012-09-16T18:28:20","date_gmt":"2012-09-16T16:28:20","guid":{"rendered":"http:\/\/ubik75.com\/?p=779"},"modified":"2012-09-16T18:29:57","modified_gmt":"2012-09-16T16:29:57","slug":"debogage-sur-nxt","status":"publish","type":"post","link":"https:\/\/ubik75.com\/?p=779","title":{"rendered":"D\u00e9bogage sur NXT"},"content":{"rendered":"<p>Que ce soit sur RobotC ou NXT G nous avons toujours besoin de d\u00e9boger un programme. Il existe plusieurs fa\u00e7ons que je vais vous pr\u00e9senter.<\/p>\n<p><!--more--><\/p>\n<p>Pour RobotC, il existe trois fa\u00e7ons:<\/p>\n<ol>\n<li>Ajouter des sons dans le programme afin de d\u00e9terminer quelle partie du code est ex\u00e9cut\u00e9e.<\/li>\n<li>Utiliser l&rsquo;\u00e9cran LCD comme interface en affichant diff\u00e9rentes valeurs de variables \u00e0 l&rsquo;\u00e9cran, voir <a href=\"http:\/\/ubik75.com\/?p=819\" target=\"_blank\">cet article<\/a>.<\/li>\n<li>Utiliser la m\u00e9thode <strong>Debug Stream<\/strong> pour faire appara\u00eetre les variables dans une fen\u00eatre.<\/li>\n<\/ol>\n<p>La fonction de <strong>Debug Stream<\/strong> est la plus int\u00e9ressante, dans une fen\u00eatre, on peut afficher toutes les variables que l&rsquo;on veut.<\/p>\n<p><a href=\"http:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug1.jpg\" rel=\"lightbox\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"886\" data-permalink=\"https:\/\/ubik75.com\/?attachment_id=886\" data-orig-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug1.jpg\" data-orig-size=\"321,596\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;ubik&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1347815384&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"debug1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug1-161x300.jpg\" data-large-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug1.jpg\" class=\"aligncenter size-medium wp-image-886\" title=\"debug1\" src=\"http:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug1-161x300.jpg\" alt=\"\" width=\"161\" height=\"300\" srcset=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug1-161x300.jpg 161w, https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug1.jpg 321w\" sizes=\"auto, (max-width: 161px) 85vw, 161px\" \/><\/a><\/p>\n<p>D\u00e8s que le mode \u00ab\u00a0Super Utilisateur\u00a0\u00bb est activ\u00e9, des fonctionnalit\u00e9s suppl\u00e9mentaires sont disponibles dans le menu \u00ab\u00a0Robot\u00a0\u00bb, menu \u00ab\u00a0Debugger Windows\u00a0\u00bb.<\/p>\n<p><a href=\"http:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug2.jpg\" rel=\"lightbox\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"889\" data-permalink=\"https:\/\/ubik75.com\/?attachment_id=889\" data-orig-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug2.jpg\" data-orig-size=\"505,219\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;ubik&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1347815797&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"debug2\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug2-300x130.jpg\" data-large-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug2.jpg\" class=\"aligncenter size-medium wp-image-889\" title=\"debug2\" src=\"http:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug2-300x130.jpg\" alt=\"\" width=\"300\" height=\"130\" srcset=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug2-300x130.jpg 300w, https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug2-500x216.jpg 500w, https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug2.jpg 505w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/a><\/p>\n<p>La commande <strong>writeDebugStreamLine()<\/strong> \u00e0 int\u00e9grer dans votre programme permet d&rsquo;afficher dans la fen\u00eatre \u00ab\u00a0Controller Debug Stream\u00a0\u00bb les variables choisies. Cette fen\u00eatre \u00ab\u00a0Controler Debug Stream\u00a0\u00bb est accessible quand votre programme est en cours d\u2019ex\u00e9cution.<\/p>\n<p><a href=\"http:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug3.jpg\" rel=\"lightbox\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"890\" data-permalink=\"https:\/\/ubik75.com\/?attachment_id=890\" data-orig-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug3.jpg\" data-orig-size=\"631,459\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;ubik&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1347815880&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"debug3\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug3-300x218.jpg\" data-large-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug3.jpg\" class=\"aligncenter size-medium wp-image-890\" title=\"debug3\" src=\"http:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug3-300x218.jpg\" alt=\"\" width=\"300\" height=\"218\" srcset=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug3-300x218.jpg 300w, https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug3-412x300.jpg 412w, https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug3.jpg 631w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/a><\/p>\n<p>T\u00e9l\u00e9charger votre programme dans la brique NXT, la fen\u00eatre \u00ab\u00a0Program Debug\u00a0\u00bb s&rsquo;affiche, appuyer sur start. Aller dans le menu \u00ab\u00a0Robot\u00a0\u00bb, menu \u00ab\u00a0Debugger Windows\u00a0\u00bb et cliquer sur \u00ab\u00a0<strong>Debug Stream<\/strong>\u00ab\u00a0.<\/p>\n<p><a href=\"http:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug4.jpg\" rel=\"lightbox\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"893\" data-permalink=\"https:\/\/ubik75.com\/?attachment_id=893\" data-orig-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug4.jpg\" data-orig-size=\"800,841\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;ubik&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1347816172&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"debug4\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug4-285x300.jpg\" data-large-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug4.jpg\" class=\"aligncenter size-medium wp-image-893\" title=\"debug4\" src=\"http:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug4-285x300.jpg\" alt=\"\" width=\"285\" height=\"300\" srcset=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug4-285x300.jpg 285w, https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug4.jpg 800w\" sizes=\"auto, (max-width: 285px) 85vw, 285px\" \/><\/a>Voil\u00e0 le programme pour effectuer vos tests:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nint i=11;\r\nint j=0;\r\nfloat x=3.141592;\r\nchar tab&#x5B;]={'R','O','B','O','T'};\r\nstring str= &quot;Bonjour Ubik75&quot;;\r\n\r\ntask main()\r\n\r\n{\r\n\r\n  writeDebugStreamLine(&quot;Entier i:%08d&quot;, i);\r\n  writeDebugStreamLine(&quot;Entier i HEXA:%x&quot;, i);\r\n  writeDebugStreamLine(&quot;Entier i HEXA:%X&quot;, i);\r\n\r\n  writeDebugStreamLine(&quot;&quot;);\r\n  writeDebugStreamLine(&quot;Nbre   x:%f&quot;, x);\r\n\r\n  writeDebugStreamLine(&quot;Nbre   x:%1.0f&quot;, x);\r\n  writeDebugStreamLine(&quot;Nbre   x:%1.2f&quot;, x);\r\n  writeDebugStreamLine(&quot;Nbre   x:%1.4f&quot;, x);\r\n\r\n  writeDebugStreamLine(&quot;&quot;);\r\n  for (j = 0; j&lt; 5; j++)\r\n    {\r\n      writeDebugStreamLine(&quot;%c &quot;,tab&#x5B;j]);\r\n    }\r\n\r\n  writeDebugStreamLine(&quot;&quot;);\r\n\r\n  writeDebugStreamLine(&quot;Chaine str: %s&quot;, str);\r\n\r\n}\r\n<\/pre>\n<p>Pour NXT-G, il existe deux fa\u00e7ons:<\/p>\n<ol>\n<li>Ajouter des sons dans le programme afin de d\u00e9terminer quelle partie du code est ex\u00e9cut\u00e9e.<\/li>\n<li>Utiliser l&rsquo;\u00e9cran LCD comme interface en affichant diff\u00e9rentes valeurs de variables \u00e0 l&rsquo;\u00e9cran.<\/li>\n<\/ol>\n<p><a href=\"http:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug5.jpg\" rel=\"lightbox\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"915\" data-permalink=\"https:\/\/ubik75.com\/?attachment_id=915\" data-orig-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug5.jpg\" data-orig-size=\"310,445\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;ubik&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1347818517&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"debug5\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug5-208x300.jpg\" data-large-file=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug5.jpg\" class=\"aligncenter size-medium wp-image-915\" title=\"debug5\" src=\"http:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug5-208x300.jpg\" alt=\"\" width=\"208\" height=\"300\" srcset=\"https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug5-208x300.jpg 208w, https:\/\/ubik75.com\/wp-content\/uploads\/2012\/09\/debug5.jpg 310w\" sizes=\"auto, (max-width: 208px) 85vw, 208px\" \/><\/a>J\u2019esp\u00e8re que cet article vous aidera \u00e0 d\u00e9boger vos programmes.<\/p>\n","protected":false},"excerpt":{"rendered":"<img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/ubik75.com\/wp-content\/plugins\/thumbnail-for-excerpts\/tfe_no_thumb.png\" class=\"alignleft wp-post-image tfe\" alt=\"\" title=\"\" \/><p>Que ce soit sur RobotC ou NXT G nous avons toujours besoin de d\u00e9boger un programme. Il existe plusieurs fa\u00e7ons que je vais vous pr\u00e9senter.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6,10,84],"tags":[132],"class_list":["post-779","post","type-post","status-publish","format-standard","hentry","category-logiciel","category-nxt-g","category-robotc","tag-nxt-g"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2eCSX-cz","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ubik75.com\/index.php?rest_route=\/wp\/v2\/posts\/779","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubik75.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubik75.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubik75.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubik75.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=779"}],"version-history":[{"count":41,"href":"https:\/\/ubik75.com\/index.php?rest_route=\/wp\/v2\/posts\/779\/revisions"}],"predecessor-version":[{"id":923,"href":"https:\/\/ubik75.com\/index.php?rest_route=\/wp\/v2\/posts\/779\/revisions\/923"}],"wp:attachment":[{"href":"https:\/\/ubik75.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=779"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubik75.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=779"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubik75.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}