SkillDev4- Chengzhi Zhang

Made by Chengzhi Zhang

Created: November 28th, 2021

0
int servoPin = A3;
int servoPosition = 0;
Servo servo;

void setup()
{
  //Serial.begin( 9600 );
  //Particle.function( "pos", setPosition );
  servo.attach( servoPin );
}

void loop()
{
  for (servoPosition = 0; servoPosition <= 180; servoPosition+=1) {
      servo.write(servoPosition);
      delay(15);
  }
  for (servoPosition = 180; servoPosition >= 0; servoPosition-=1) {
      servo.write(servoPosition);
      delay(15);
  }
}
Click to Expand
0
IoTSkillDev4.1
Chengzhi Zhang - https://youtu.be/e94XUZ5Tgdo
0
int servoPin = A3;
int servoPosition;
Servo servo;
int countDown;
// bool flag = true;
void setup()
{
  Serial.begin( 9600 );
  countDown = Particle.function( "Set time to remind (unit: seconds):", setTime );
  servo.attach( servoPin );
}

void loop() {
    

  delay( countDown * 1000);

  
  for (servoPosition = 0; servoPosition <= 180; servoPosition+=1) {
      servo.write(servoPosition);
      delay(5);
  }
    for (servoPosition = 0; servoPosition <= 180; servoPosition+=1) {
      servo.write(servoPosition);
      delay(5);
  }
  
//   for (servoPosition = 180; servoPosition >= 0; servoPosition-=1) {
//       servo.write(servoPosition);
//       delay(5);
//   }
      
  //pinMode( servoPin, OUTPUT );
  //pinMode( servoPin, INPUT );
}


int setTime( String command ){
  Serial.println( "setTime: " + command );
  return command.toInt();
  }
Click to Expand
0

Use Case:

Using the pomodoro sticker to make it vibrate when it reaches the pomodoro time that the user should take a break. 

0
IoTskillDev4.2
Chengzhi Zhang - https://youtu.be/M8cHrQQ5VDc
0

Outcome

    • The servo could move forth 180 degrees and back 180 degrees
    • The servo could take the time as input and remind the user to take a break for the time user set: "pomodoro time" the user set. I drew this inspiration from the "pomodoro technique" application that I use in my computer. When the user put in the desired pomodoro time, it will remind the user to take a break after that time(in minute). 
0

Process

Firstly, I used the servo with simple code to test whether the servo works or not. The servo does not have great connectivity. It works better when I pushed the jumper wires to the bread board. Laters on, I tried to implement the particle function with servo. I drew inspiration from the Google paper prototype and also the "pomodoro technique" software that I use. In the end, the servo doesn't work that stable.

0

Reflection

Reflecting on last time's project, I made improvements on the code of my project, like calling the function input a more intuitive name and so on. It turned out to be it has really bad connectivity so that the servo is not running in an ideal way. Next time, when you have confidence in your code, maybe it's not the code to blame, but the physical prototype that you should keep an eye on and test. Maybe test it with other people's prototype will work

x