设为首页收藏本站

arduino 单片机机器人爱好者之家

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 764|回复: 2

4轴飞行器

[复制链接]

签到天数: 27 天

[LV.4]偶尔看看III

发表于 2016-5-8 12:53:41 | 显示全部楼层 |阅读模式
4轴飞行器 程序
[AppleScript] 纯文本查看 复制代码
const int dj1=A0,dj2=A1,dj3=A2,dj4=A3;
int readpin=9;
void setup() 
{
  pinMode(readpin,INPUT);
}

void loop() 
{
  int analogread=analogRead(readpin);
  if(analogread=1)
  {
    analogWrite(dj1,100);
    analogWrite(dj2,100);
    analogWrite(dj3,100);
    analogWrite(dj4,100);
  }
 if(analogread=2)
  {
    analogWrite(dj1,50);
    analogWrite(dj2,50);
    analogWrite(dj3,100);
    analogWrite(dj4,100);
  delay(1000);
    analogWrite(dj1,100);
    analogWrite(dj2,100);
    analogWrite(dj3,100);
    analogWrite(dj4,100);}
 if(analogread=3)
  {
    analogWrite(dj1,100);
    analogWrite(dj2,100);
    analogWrite(dj3,50);
    analogWrite(dj4,50);
  delay(1000);
    analogWrite(dj1,100);
    analogWrite(dj2,100);
    analogWrite(dj3,100);
    analogWrite(dj4,100);
  }
 if(analogread=4)
  {
    analogWrite(dj1,30);
    analogWrite(dj2,30);
    analogWrite(dj3,30);
    analogWrite(dj4,30);
  }
 if(analogread=5)
  {
    analogWrite(dj1,30);
    analogWrite(dj2,30);
    analogWrite(dj3,100);
    analogWrite(dj4,100);
  delay(1000);
    analogWrite(dj1,100);
    analogWrite(dj2,100);
    analogWrite(dj3,100);
    analogWrite(dj4,100);
   }
  
   if(analogread=6)
  {
    analogWrite(dj1,100);
    analogWrite(dj2,100);
    analogWrite(dj3,30);
    analogWrite(dj4,30);
  delay(1000);
    analogWrite(dj1,100);
    analogWrite(dj2,100);
    analogWrite(dj3,100);
    analogWrite(dj4,100);
   }
  
    if(analogread=7)
  {
    analogWrite(dj1,100);
    analogWrite(dj2,100);
    analogWrite(dj3,10);
    analogWrite(dj4,10);

   
   }}

签到天数: 3 天

[LV.2]偶尔看看I

发表于 2016-7-6 21:06:10 | 显示全部楼层
什么呀,没头没脑
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|联系我们|YFRobot ( 苏ICP备13017135  

GMT+8, 2017-6-26 23:26 , Processed in 0.386768 second(s), 26 queries .

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表