Aurdino Programming

I programme the arduino board by using Arduino IDE app which installed in the laptop.After I connect the USB Micro Port B with arduino board and mt laptop,then I open the Arduino IDE app and go to  File > Examples > Servo > Sweep. Then I adjust the value for pos value in the void loop part, one is used to control the servo from 0o to 180o and the other is used to control the servo from  180o to 0o   .Besides I also adjust the value for delay part  .As I finish adjusting these value so I can get the speed of servo motor moving desired.




The code below is the source codes I used 

#include <Servo.h>


Servo myservo;  // create servo object to control a servo

// twelve servo objects can be created on most boards


int pos = 0;    // variable to store the servo position

 

void setup() {

  myservo.attach(9);  // attaches the servo on pin 9 to the servo object

}


void loop() {

  for (pos = 0; pos <= 170; pos += 1) { // goes from 0 degrees to 20 degrees

    // in steps of 1 degree

    myservo.write(pos);              // tell servo to go to position in variable 'pos'

    delay(1);                       // waits 0ms for the servo to reach the position

  }

  for (pos = 170; pos >= 0; pos -= 1) { // goes from 150 degrees to 0 degrees

    myservo.write(pos);              // tell servo to go to position in variable 'pos'

    delay(2);                       // waits 15ms for the servo to reach the position

  }

}


In the arduino programming practical,we feel easy to build up the unicorn model from cardboard but we face the problem is how we fix the position of servo motor and hidden it to make the unicorn to look nicer. The wings of unicorn to flap synchronous is also a problem we need to overcome. Therefore,we decide to use hot glue gun to fix the servo motor below the unicorn.For the wings part, we use a tiny metal wire to cross through the small hole on the pair of wings and tie it tightly with servo motor. So , when servo motor start to move, the wings will flap automatically and synchronously.

This is a  short video of the executed program work?



In this arduino programming practical, I have done a reflection for myself.In this practical, we have realised that the Arduino Programme is very useful since it can provide motion to a prototype so make it life-like. It is related to the laser cutting practical so we can combine two skills together to build up a prototype that can move automatically.In the practical,we have been tested to adjust the code in order to make the light of pin12 light s on in the consequence of 2 seconds and followed by the pin10 and then the last is pin8. Since Haijie and Yongjie submit  the documentation for pre-practical late,they cannot carry out the test and Peijie just does it alone. However, Haijie and Yongiie contribute much to the other project which is making the unicorn that can flap its wings automatically. Three of us discuss the steps first before we start everythings. Yongjie and Haijie start to build up unicorn until coding by using a short time while Peijie goes for a test and finds the solution to the test when go back to his seat since he need to do it twice.This shows the teamwork among us.

This Arduino programme is essential since it can make a prototype move and looks nicer than the prototype that cannot move.At first we feel annoying to the  common unicorn but we fall in interest to it when we know that it can flap its wings automatically.We become passionate fully during carry out this task .This skill is very useful as we use this skill and the laser cutting skill that we learnt before so we can build up a special prototype which is different to market nowaday so it is very useful fo module CP5070.

We used to think this skill is useless and annoying because we dislike coding and we think it is useless for student in chemical engineering.Now we think that it is good for us since we do not need to type out all the code and we realise that actually it is very easy when we finish the practical.We are very satisfy with this skill that we learnt because it is easy and useful to us although we are chemical engineering student.So next we will participate actively and prevent the case of submit pre-practical late happening again so Yongjie and Haijie can join the test together.We hope that the next practical can teach us the skill that related to laser cutting skill and arduino programming skill so we can design a better product in the end of semester.We can use this skill and the laser cutting skill together to build up a model we favor which is animation so make it vivid.


Comments

Popular posts from this blog

HYPOTHESIS TESTING

DESIGN OF EXPERIMENT