{"id":1303,"date":"2024-03-27T17:52:58","date_gmt":"2024-03-27T17:52:58","guid":{"rendered":"https:\/\/ramonnoria.es\/?page_id=1303"},"modified":"2024-03-27T17:56:08","modified_gmt":"2024-03-27T17:56:08","slug":"arduino-linear-actuator","status":"publish","type":"page","link":"https:\/\/ramonnoria.es\/index.php\/arduino-linear-actuator\/","title":{"rendered":"ARDUINO &#8211; LINEAR ACTUATOR"},"content":{"rendered":"\n<p>For the integration with Arduino, I made a very simple code to make the linear actuator work. As I said before, Arduino is a very flexible device that allows you to implement almost anything you wish most easily. <\/p>\n\n\n\n<div class=\"wp-block-media-text is-stacked-on-mobile\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"864\" height=\"790\" src=\"https:\/\/ramonnoria.es\/wp-content\/uploads\/2024\/03\/Captura-de-Pantalla-2024-03-27-a-las-17.41.25-4.png\" alt=\"\" class=\"wp-image-1307 size-full\" srcset=\"https:\/\/ramonnoria.es\/wp-content\/uploads\/2024\/03\/Captura-de-Pantalla-2024-03-27-a-las-17.41.25-4.png 864w, https:\/\/ramonnoria.es\/wp-content\/uploads\/2024\/03\/Captura-de-Pantalla-2024-03-27-a-las-17.41.25-4-300x274.png 300w, https:\/\/ramonnoria.es\/wp-content\/uploads\/2024\/03\/Captura-de-Pantalla-2024-03-27-a-las-17.41.25-4-768x702.png 768w\" sizes=\"auto, (max-width: 864px) 100vw, 864px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p>The code moves the servomotor from 0 to 180 degrees back and forth in a loop. As soon as the code is launched, it will start moving.<\/p>\n<\/div><\/div>\n\n\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;Servo.h>\n\n\/\/ Define the pin to which the servo motor is connected\n#define SERVO_PIN 9\n\n\/\/ Create a Servo object\nServo myServo;\n\nvoid setup() {\n  \/\/ Initialize the servo motor on the specified pin\n  myServo.attach(SERVO_PIN);\n}\n\nvoid loop() {\n  \/\/ Move the servo motor from 0 to 180 degrees in 1 degree increments\n  for (int angle = 0; angle &lt;= 180; angle++) {\n    myServo.write(angle); \/\/ Send the angle to the servo motor\n    delay(15); \/\/ Wait for 15 milliseconds before changing the angle (adjust as necessary)\n  }\n  \n  \/\/ Move the servo motor from 180 to 0 degrees in 1 degree increments\n  for (int angle = 180; angle >= 0; angle--) {\n    myServo.write(angle); \/\/ Send the angle to the servo motor\n    delay(15); \/\/ Wait for 15 milliseconds before changing the angle (adjust as necessary)\n  }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>For the integration with Arduino, I made a very simple code to make the linear actuator work. As I said before, Arduino is a very flexible device that allows you to implement almost anything you wish most easily. The code moves the servomotor from 0 to 180 degrees back and forth in a loop. As [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"saved_in_kubio":false,"footnotes":""},"class_list":["post-1303","page","type-page","status-publish","hentry"],"kubio_ai_page_context":{"short_desc":"","purpose":"general"},"_links":{"self":[{"href":"https:\/\/ramonnoria.es\/index.php\/wp-json\/wp\/v2\/pages\/1303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ramonnoria.es\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ramonnoria.es\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ramonnoria.es\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ramonnoria.es\/index.php\/wp-json\/wp\/v2\/comments?post=1303"}],"version-history":[{"count":4,"href":"https:\/\/ramonnoria.es\/index.php\/wp-json\/wp\/v2\/pages\/1303\/revisions"}],"predecessor-version":[{"id":1310,"href":"https:\/\/ramonnoria.es\/index.php\/wp-json\/wp\/v2\/pages\/1303\/revisions\/1310"}],"wp:attachment":[{"href":"https:\/\/ramonnoria.es\/index.php\/wp-json\/wp\/v2\/media?parent=1303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}