Skills Dev 4 -Amal

Made by Amal Jafrani

Created: December 1st, 2021

0

Outcome

    • the goal of this project was to experiment with the servo
0

Process

I started with skills dev 5 as a group and we worked on using connectivity with the servo, so during that skills dev I already started experimenting with the servo. Coming into this activity I was already familiar with the servo and how it worked, but I wanted to better understand the values and how it related to each position. That is why I experimented with particle function, so that I could input different values and see what position would appear on the servo. 

0

Reflection

Overall, I think it would have been helpful to start with skills dev 4 before 5 because it would have set us up better for focusing on the connectivity aspect, but going backwards also made this activity more enjoyable and allowed me to focus on what I wanted to learn about servos.

0
int servoPin = A3;

Servo myServo;
int servoPos = 0;

void setup() {
    myServo.attach( A3 );
    pinMode(servoPin, OUTPUT);
    
    
    Particle.function("servo", servoControl);
    Particle.variable(  "servoPos" , &servoPos , INT );
}


void loop() {

    
}


int servoControl(String command)
{
   int newPos = command.toInt();
   servoPos = constrain( newPos, 0 , 180);

   myServo.write( servoPos );

   return 1;
}
Click to Expand
x