Infection
2011年3月18日星期五
2011年3月10日星期四
Model 5
#包括<Servo.h>
伺服myservo;
浮motorSpeed;
浮motorValue;
无效的setUp(){
myservo.attach(9);
myservo.write(0);
motorSpeed = 0.2;
motorValue = 0.0;
/ /检查
Serial.begin(9600);
}
无效循环(){
//------------------------------------------------ - 电机
motorValue = motorValue + motorSpeed;
如果(motorValue> = 179){
motorValue = 0;
}
Serial.println(motorValue);
myservo.write((int)的motorValue);
//------------------------------------------------ - 领导
}
2011年3月8日星期二
Model 4
This time we add the program, we use a whole ball and sand blast for the surface. The stem was bend successful. But we want to use half a ball, because so many lines on the ball, all the line in the flower stem, we had to use high strength to pull these lines and make the lines curly, but the maximum strength of the motor is not enough.
Program:
#include <Servo.h>
int sensor=1;//传感器接在1号模拟输入口
int redLed=3;//红色LED接在3号数字口(带PWM输出)
int greenLed=5;//绿色LED接在5号数字口(带PWM输出)
int blueLed=6;//蓝色LED接在6号数字口(带PWM输出)
int sensorVal=0;//存储传感器读数
boolean flag=true;
Servo myservo;
void setup(){
//把LED的三个接口设置成输出
pinMode(redLed,OUTPUT);
pinMode(greenLed,OUTPUT);
pinMode(blueLed,OUTPUT);
myservo.attach(9);
myservo.write(150);
}
void loop(){
if (flag==true){
for (int j=0;j<20;j++){
for (int i=0;i<1024;i+=50) {
sensorVal=i;//读传感器数值
sensorVal=constrain(sensorVal,0,1023);//把数值的范围限定下来(根据装置的使用环境设定)
sensorVal=map(sensorVal,0,1023,0,270); //把传感器的数值转换成角度值
int val1=255*sin(3.1416*sensorVal/180);//把角度值变成PWM电压变化(根据电压变化曲线)
int val2=255*cos(3.1416*sensorVal/180);
int valSin=abs(val1);//取绝对值(根据电压变化曲线)
int valCos=abs(val2);
//设定判断条件,决定三个不同区间的对应操作(根据电压变化曲线)
if (sensorVal>=0 && sensorVal<90)
{
analogWrite(redLed,valSin);
analogWrite(blueLed,valCos);
analogWrite(greenLed,0);
}else if (sensorVal>=90 && sensorVal<180){
analogWrite(redLed,valSin);
analogWrite(greenLed,valCos);
analogWrite(blueLed,0);
}else{
analogWrite(greenLed,valCos);
analogWrite(blueLed,valSin);
analogWrite(redLed,0);
}
delay(10);
}
}
flag=false;
digitalWrite(redLed,LOW);
digitalWrite(blueLed,LOW);
digitalWrite(greenLed,LOW);
myservo.write(0);
delay(1000);
myservo.write(179);
delay(1000);
}
}
Program:
#include <Servo.h>
Servo myservo;
float motorSpeed;
float motorValue;
void setup(){
myservo.attach(9);
myservo.write(0);
motorSpeed = 0.2;
motorValue = 0.0;
//for checking
Serial.begin(9600);
}
void loop(){
//------------------------------------------------- motor
motorValue = motorValue + motorSpeed;
if(motorValue>=90) {
motorValue = 90;
}
Serial.println(motorValue);
myservo.write((int)motorValue);
//------------------------------------------------- led
}
2011年3月3日星期四
Model 3
We tried to find some new ways to make the flower fade.
lights test
This lights effect means some people are doing exercise at home.
Next, we will design the mechanical structure and began making the models.
2011年3月1日星期二
2011年2月24日星期四
Fading
This time we added a fading process to our design, so that in contrast to motion. Then we tested lights, although the material is not that the optical fiber, but basically the same design.
this time we used the ugly state:
if the person did not do sports for a long time,
the flower will drop head.
also the lights will darken.
there is a line connect to the flower. if we pull this line only, the flower's head will drop.
this time we used the ugly state:
if the person did not do sports for a long time,
the flower will drop head.
also the lights will darken.
there is a line connect to the flower. if we pull this line only, the flower's head will drop.
订阅:
博文 (Atom)











