用Arduino抢红包哈哈
双11到了,对于一些简单到不行的淘宝小游戏,又何必亲自动手玩呢程序也很简单,哈哈
// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!
#include <AFMotor.h>
AF_DCMotor motor1(4);
AF_DCMotor motor2(3);
uint8_t analog = A0;
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Motor test!");
// turn on motor
motor1.setSpeed(255);
motor1.run(RELEASE);
pinMode(analog, INPUT);
}
void loop() {
uint8_t i = 255;
Serial.print("tick");
motor1.run(FORWARD);
while(1){
motor1.setSpeed(i);
delay(analogRead(analog)/5);
--i;
if(i < 190)i = 250;
}
//delay(1000);
//motor.run(BACKWARD);
//motor1.run(RELEASE);
//delay(200);
} 能不能介绍一下你用的硬件?点击屏幕用的是什么硬件? eysajan 发表于 2015-11-7 17:39 static/image/common/back.gif
能不能介绍一下你用的硬件?点击屏幕用的是什么硬件?
看图应该是adafruit 的motor shield 玩的是什么app 电容笔的笔头加舵机或电磁铁就OK了 麻烦能不能把头文件AMmotor发出来一下,谢谢 eysajan 发表于 2015-11-7 17:39 static/image/common/back.gif
能不能介绍一下你用的硬件?点击屏幕用的是什么硬件?
x宝杰盛电机家买的电磁铁,好像不到1块钱
驱动就那个293d 414545584 发表于 2015-11-8 17:46 static/image/common/back.gif
麻烦能不能把头文件AMmotor发出来一下,谢谢
我也是参考的
Arduino电机驱动板L293d详解
http://www.geek-workshop.com/thread-24993-1-1.html
页:
[1]