智能植物养护机器人

发布时间:2024-12-12 13:52

智能扫地机器人日常维护保养 #生活技巧# #居家生活技巧# #家居保养技巧# #智能家居操作指南#

#include <Servo.h>

#include <Servo.h>

int _ABVAR_1_lanya = 0 ;

int _ABVAR_1_yuyin= 0 ;

Servo servo_pin_3;

Servo servo_pin_11;

Servo servo_pin_12;

void setup()

{

  pinMode( 5, OUTPUT);

  pinMode( 6, OUTPUT)

  pinMode( 9, OUTPUT);

  pinMode( 10, OUTPUT);

  Serial.begin(9600);

  pinMode( 5 , OUTPUT);

pinMode( 6 , OUTPUT);

  pinMode( 9 , OUTPUT);

  pinMode( 10 , OUTPUT);

  servo_pin_3.attach(3);

  servo_pin_11.attach(11);

  servo_pin_12.attach(12);

  }

void loop()

{

  _ABVAR_1_lanya = Serial.parseInt() ;

  if (( ( _ABVAR_1_lanya ) == ( 1 ) ))//正转

  {

    digitalWrite( 5 , HIGH );

    digitalWrite( 6 , LOW );

    digitalWrite( 9 , HIGH );

    digitalWrite( 10 , LOW );

  }

  if (( ( _ABVAR_1_lanya ) == ( 2 ) ))//反转

  {

    digitalWrite( 5 , LOW );

    digitalWrite( 6 , HIGH );

    digitalWrite( 9 , LOW );

    digitalWrite( 10 , HIGH );

  }

  if (( ( _ABVAR_1_lanya ) == ( 3 ) ))//停止

  {

    digitalWrite( 5 , LOW );

    digitalWrite( 6 , LOW );

    digitalWrite( 9 , LOW );

    digitalWrite( 10 , LOW );

  }

  if (( ( _ABVAR_1_lanya ) == ( 4 ) ))//减速前进

  {

    analogWrite(5 , 100);

    analogWrite(6 , 0);

    analogWrite(9 , 100);

    analogWrite(10 , 0);

  }

  if (( ( _ABVAR_1_lanya ) == ( 5 ) ))//减速后退

  {

    analogWrite(5 , 0);

    analogWrite(6 , 100);

    analogWrite(9 , 0);

    analogWrite(10 , 100);

  }

  while ( ( ( _ABVAR_1_lanya ) == ( 6 ) ) )//手爪抓合

  {

    servo_pin_3.write( 0 );

    servo_pin_3.write( 40 );

  }

  while ( ( ( _ABVAR_1_lanya ) == ( 7 ) ) )//花盆旋转

  {

    servo_pin_11.write( 0 );

    servo_pin_11.write( 30 );

servo_pin_11.write( 0 );

    servo_pin_11.write( 30 );

servo_pin_11.write( 0 );

    servo_pin_11.write( 30 );

  }

  while ( ( ( _ABVAR_1_lanya ) == ( 8 ) ) )//松土臂

  {

    servo_pin_12.write( 10 );

    servo_pin_12.write( 30 );

  }

}

void setup()

  {

  pinMode( 5, OUTPUT);/左轮

  pinMode( 6, OUTPUT);

  pinMode( 9, OUTPUT);//右轮

  pinMode( 10, OUTPUT);

  servo_pin_3.attach(3);//手爪

  servo_pin_11.attach(11);//花盆旋转

  servo_pin_12.attach(12);//松土臂

}

void loop() {

  {

  _ABVAR_1_yuyin = Serial.parseInt() ;

  if (( ( _ABVAR_1_yuyin ) == ( 1 ) ))//正转

  {

    digitalWrite( 5 , HIGH );//高电平

    digitalWrite( 6 , LOW );//低电平

    digitalWrite( 9 , HIGH );

    digitalWrite( 10 , LOW );

  }

  if (( ( _ABVAR_1_yuyin ) == ( 2 ) ))//反转

  {

    digitalWrite( 5 , LOW );

    digitalWrite( 6 , HIGH );

    digitalWrite( 9 , LOW );

    digitalWrite( 10 , HIGH );

  }

  if (( ( _ABVAR_1_yuxin ) == ( 3 ) ))//停止

  {

    digitalWrite( 5 , LOW );//低电平

    digitalWrite( 6 , LOW );//低电平

    digitalWrite( 9 , LOW );//低电平

    digitalWrite( 10 , LOW );//低电平

  }

  while ( ( ( _ABVAR_1_yuyin ) == ( 6 ) ) )//手爪抓合

  {

    servo_pin_3.write( 0 );

    servo_pin_3.write( 40 );

  }

  while ( ( ( _ABVAR_1_yuyin ) == ( 7 ) ) )//花盆旋转

  {

    servo_pin_11.write( 0 );//0°

    servo_pin_11.write( 30 );30°

    servo_pin_11.write( 0 );

    servo_pin_11.write( 30 );

    servo_pin_11.write( 0 );

    servo_pin_11.write( 30 );

  }

  while ( ( ( _ABVAR_1_yuyin) == ( 8 ) ) )//松土臂

  {

    servo_pin_12.write( 10 );

    servo_pin_12.write( 30 );

  }

}

}

网址:智能植物养护机器人 https://www.yuejiaxmz.com/news/view/453321

相关内容

一种多功能智能绿植养护机器人的制作方法
家庭智能植物养护系统的制作方法
植物养护方法(植物养护)
静安居家养老机器人,智能呵护老年人的生活
植物养护
家居植物养护问答
家居绿植养护 植树节教你养护植物
ARM处理器的绿色家居植物养护控制装置研究
植物养护 盘点植物养护小妙招
智能机器人:引领养老居家生活的无限便利

随便看看