{"id":555,"date":"2024-05-10T19:36:15","date_gmt":"2024-05-10T18:36:15","guid":{"rendered":"http:\/\/robert.vanyi.org\/en\/?p=555"},"modified":"2024-05-10T20:33:52","modified_gmt":"2024-05-10T19:33:52","slug":"testing-the-arduino","status":"publish","type":"post","link":"https:\/\/robert.vanyi.org\/en\/archives\/555","title":{"rendered":"Testing the Arduino"},"content":{"rendered":"\n<p>I already wanted to get an Arduino to do some experiments, but the final push was seeing Ben Eater using an Ardino Mega do do some debugging on his 6502 computer. Now that we have built up the astable and monostable timers and the Arduino also arrived it was time to test it. <\/p>\n\n\n\n<p>The setup I used is quite simple: connect GND to the common ground, and pin 2 to the clock signal from the breadboard and then hook up an interrupt with pin 2 that prints out something. For the HW setup just two jumper wires are needed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/robert.vanyi.org\/en\/wp-content\/uploads\/2024\/05\/arduino-test.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"https:\/\/robert.vanyi.org\/en\/wp-content\/uploads\/2024\/05\/arduino-test.jpg\" alt=\"\" class=\"wp-image-556\" srcset=\"https:\/\/robert.vanyi.org\/en\/wp-content\/uploads\/2024\/05\/arduino-test.jpg 800w, https:\/\/robert.vanyi.org\/en\/wp-content\/uploads\/2024\/05\/arduino-test-300x225.jpg 300w, https:\/\/robert.vanyi.org\/en\/wp-content\/uploads\/2024\/05\/arduino-test-768x576.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><figcaption class=\"wp-element-caption\">Arduino set up to monitor the clock signal<\/figcaption><\/figure>\n\n\n\n<p>And the SW isn&#8217;t too complicated either.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#define CLOCK 2\n\nunsigned int pushed;\nunsigned long lasttime;\n\nvoid setup() {\n  Serial.begin(57600);\n  Serial.println(\"Hello World\");\n\n  pushed = 0;\n\n  pinMode(CLOCK, INPUT);\n  attachInterrupt(digitalPinToInterrupt(CLOCK), onClock, RISING);\n  \n  lasttime = millis();\n}\n\nvoid onClock() {\n  unsigned long time = millis();\n  unsigned long delta = time-lasttime;\n  lasttime = time;\n\n  pushed = pushed + 1;\n\n  Serial.print(delta);\n  Serial.print(\"  You have pushed a button \");\n  Serial.print(pushed);\n  Serial.println(\" times.\");\n}\n\nvoid loop() {\n  \/\/ put your main code here, to run repeatedly:\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I already wanted to get an Arduino to do some experiments, but the final push was seeing Ben Eater using an Ardino Mega do do some debugging on his 6502 computer. Now that we have built up the astable and monostable timers and the Arduino also arrived it was time to test it. The setup &hellip; <a href=\"https:\/\/robert.vanyi.org\/en\/archives\/555\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Testing the Arduino<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[76],"tags":[72],"class_list":["post-555","post","type-post","status-publish","format-standard","hentry","category-electronics","tag-electronics"],"_links":{"self":[{"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/posts\/555","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/comments?post=555"}],"version-history":[{"count":0,"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/posts\/555\/revisions"}],"wp:attachment":[{"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/media?parent=555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/categories?post=555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robert.vanyi.org\/en\/wp-json\/wp\/v2\/tags?post=555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}