//This is the Arduino Code
/*
This sketch shows how to use DC motor to accelerate and decelerate.
created 21 Jun 2013
by johnson
This example code is in the public domain.
*/
#include <Me_BaseShield.h>
Me_BaseShield baseShield;
int speed = 0;
boolean colockwise = true;
void setup()
{
baseShield.begin();
}
void loop()
{
baseShield.runMotor2(speed);
delay(50);
if (speed == 254 || speed == -254)
colockwise = ~colockwise;
if (colockwise == true)
speed ++;
else
speed --;
}
All kins of four-bar linkages are relevant to each other inherently.
I have show the animation on http://forum.makeblock.cc/t/instruction-of-building-simple-mechanisms-with-makeblock/61 which is called Crank-rocker linkage. This mechanism show above is called Slider-crank linkage, it is one evolution from Crank-rocker linkage. They are all one of the four bar-linkages, if we converting a turning pair into a slider pair on the rocker, it will get the mechanism. The rocker sweep before will be slider and move back and forth.
Compare with Crank-rocker which convert rotation to sweep, this mechanism convert rotation to move, if the crank is rotated follow constant angular speed, the slider’s speed and displacement will move obey sine curves.
Hi, every one who use makeblock as me. I was major in mechatronics in University. As many Maker and DIYer, I also play with Arduino, RaspberryPI etc…, use this tools to build Robot or Automation equipment. Many people are major in Electrical or Computer Science want to join in. Code or PCB is not a problem for them, but you may need some knowledge about mechanisms, That’s the reason I decide to write a serial passages to introduce it here.
I try to explain it simplify and easily , use animation or picture, all the concept can be find in the text book of mechanisms, but it usually evolve hard stuff - advanced mathematics, I will try to avoid that, we just seek fun from Makeblock. If anyone agree my idea about write these passages, tell me in the blew comment or send E-mail:johnson@makeblock.cc
This passage is also published on my sina blog with Bilingual Edtion(English/Chinese), if you want to read it , please proceed to [url:1weawhoq]http://blog.sina.com.cn/s/blog_bfb28b380101o3rq.html[/url:1weawhoq], Think you!