#include <Servo.
h> //Include the Servo Library
int degree=0;
String words;
Servo servo1; // "Servos" objects are created
void setup() {
// put your setup code here, to run once:
[Link](9600);
[Link]("Servos - Arduino");
//[Link](5); //Default
[Link](5,600,2400);
[Link](0);
}
void loop() {
// put your main code here, to run repeatedly:
while ([Link]()) { // Read the value sent by the Serial Port
delay(5);
char c = [Link](); // Read the characters
words += c; // Convert Characters to character string
}
if ([Link]()>0){
degree = [Link](); // Convert character string to integers
[Link](degree); //Send value in Degrees
[Link](" Grados");
delay(5);
[Link](degree); // Ajuste de 512 vueltas a los 360 grados
while([Link]()<degree-3)
{[Link]("Desplazando...");}
}
words = ""; // Initialize the string of characters received
}
Cod
#include <Servo.h> //Include the Servo Library
int dir=0,menu=1,opc=0;
char c='<pre class="EnlighterJSRAW" data-enlighter-language="c" data-enlighter-theme="" data-
enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-
title="" data-enlighter-group="">#include <Servo.h> //Include the Servo Library
int dir=0,menu=1,opc=0;
char c='\0';
String words;
Servo servo1; // "Servos" objects are created
void setup() {
// put your setup code here, to run once:
[Link](9600);
[Link]("Servo 360 - Arduino");
//[Link](5); //Default
[Link](5);
[Link](90);
void loop() {
// put your main code here, to run repeatedly:
if(menu==1){
[Link](" ");
[Link]("------------ DIGUITE UNA OPCIÓN ENTRE 1 Y 3 -------------");
[Link]("1) Detener Motor");
[Link]("2) Sentido Horario");
[Link]("3) Sentido Anti-Horario");
menu=0;
while ([Link]()) { // Read the value sent by the Serial Port
delay(5);
c = [Link](); // Read the characters
words += c; // Convert Characters to character string
opc=[Link]();
if (opc!=0){
if(opc>=1 && opc<=3){
switch(opc){
case 1:
[Link](90);
[Link](">>>>> Motor DETENIDO! <<<<<<");
break;
case 2:
[Link](0);
[Link](">>>>> GIRANDO SENTIDO CW <<<<<<");
break;
case 3:
[Link](180);
[Link](">>>>> GIRANDO SENTIDO CCW <<<<<<");
break;
}else{
[Link](" OPCIÓN INVALIDA!!!! INTENTE NUEVAMENTE");
menu=1;
opc=0;
words = ""; // Initialize the string of characters received
}</pre>';
String words;
Servo servo1; // "Servos" objects are created
void setup() {
// put your setup code here, to run once:
[Link](9600);
[Link]("Servo 360 - Arduino");
//[Link](5); //Default
[Link](5);
[Link](90);
void loop() {
// put your main code here, to run repeatedly:
if(menu==1){
[Link](" ");
[Link]("------------ DIGUITE UNA OPCIÓN ENTRE 1 Y 3 -------------");
[Link]("1) Detener Motor");
[Link]("2) Sentido Horario");
[Link]("3) Sentido Anti-Horario");
menu=0;
while ([Link]()) { // Read the value sent by the Serial Port
delay(5);
c = [Link](); // Read the characters
words += c; // Convert Characters to character string
opc=[Link]();
if (opc!=0){
if(opc>=1 && opc<=3){
switch(opc){
case 1:
[Link](90);
[Link](">>>>> Motor DETENIDO! <<<<<<");
break;
case 2:
[Link](0);
[Link](">>>>> GIRANDO SENTIDO CW <<<<<<");
break;
case 3:
[Link](180);
[Link](">>>>> GIRANDO SENTIDO CCW <<<<<<");
break;
}else{
[Link](" OPCIÓN INVALIDA!!!! INTENTE NUEVAMENTE");
menu=1;
opc=0;
words = ""; // Initialize the string of characters received