2020-2-9 10:23:57 [显示全部楼层]
2741浏览
查看: 2741|回复: 7

[项目] [2020]'春节宅家一起造“在家无聊,来场激光打’病毒’

[复制链接]
新冠病毒让大家挺闹心的,大家都希望病痛早点消停,武汉早日恢复平静祥和。既然没地方去,不如打打‘病毒’。

效果是:当激光枪的激光束打到光敏电阻上,改变了光敏电阻预设的阈值时候,伺服电机会带动‘病毒’倒下,同时ISD录音模块被触发,发出哀嚎声。
ISO1820在连上线,并通电后,直接按REC按键,就可以录最大10秒的录音。按Play可以听录音效果。


==========================================
硬件使用如下:

1.Arduino UNO
[2020]
2.arduino sensor shield
[2020]
3.9g 伺服
[2020]
4.光敏电阻
[2020]
5.ISD1820
[2020]
6。激光模组
[2020]
7.微动开关

============================
连线部分有两个,主模块的连线如下
[2020]
激光枪连线如下
[2020]============================代码部分===============

[mw_shl_code=applescript,false]/* made by gada888--------luoyang of China--2020-2------*/

#include <Servo.h>

Servo myservo;                                                    //name servo
int photocellPin = 0;                                             //define photo cell reading input
int photocellReading;                                             //define photo cell reading variable
int shadeOpen = 0;
int shadeClosed = 0;

#define PLAY_E 3 // pin 3 is used for playback-edge trigger

void setup()
{
  Serial.begin(9600);                                             //initiate serial @ 9600 baud
  myservo.attach(11);                                             //define pin 11 as servo signal pin
  
  pinMode(PLAY_E,OUTPUT);
  //digitalWrite(PLAY_E,LOW);
}
void loop()
{
  Serial.print("Brightness = ");                                  //print "Brightness = "
  Serial.println(photocellReading);                               //print the photocell reading
  
  photocellReading = analogRead(photocellPin);                    //define photocellReading as pin 0 input from LDR
  photocellReading = map(photocellReading, 0, 1023, 0, 179);      //map the LDR input to a value between 1-180 so the servo can understand it
{
  if (photocellReading <= 75 && shadeClosed == 0)                 //if the LDR is showing darkness and the shade isn't closed already
    {
      myservo.write(0);                                         //then tell the servo to rotate forwards at a steady rate (close shade)
      //delay(1000);                                                //2.5 second delay while shade is closing
      digitalWrite(PLAY_E,LOW);
    }

  else if (photocellReading >= 75 && photocellReading <= 150)     //if the LDR senses neither new light or new dark (mid-day)
    {
      myservo.write(50);                                          //stop servo
      digitalWrite(PLAY_E,HIGH);
    }
   
  delay(500);
  
}
}[/mw_shl_code]==========照片部分===============
[2020]
[2020][2020]







rzyzzxw  版主

发表于 2020-2-9 11:10:51

老师,加个2020,参加活动吧。
回复

使用道具 举报

gada888  版主
 楼主|

发表于 2020-2-9 11:25:03

rzyzzxw 发表于 2020-2-9 11:10
老师,加个2020,参加活动吧。

谢提醒,已添加2020.
回复

使用道具 举报

DFrJ5KYVQaH  中级技匠

发表于 2020-2-10 11:29:38

牛,学习中
回复

使用道具 举报

且歌且行  中级技师

发表于 2020-2-16 09:23:16

看起来简单的作品,实际要费不少心思呢
回复

使用道具 举报

kylinpoet  初级技神

发表于 2020-2-18 02:05:16

多谢分享,学习了。
回复

使用道具 举报

20060606  高级技匠

发表于 2020-8-5 06:06:45

锂电池怎么充电
回复

使用道具 举报

gada888  版主
 楼主|

发表于 2020-8-5 08:50:58

20060606 发表于 2020-8-5 06:06
锂电池怎么充电

DF商城有锂电池充电板,有3.7v的和7.4v的。
回复

使用道具 举报

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

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail