你喝过鸡尾酒么?是自己调制的么?我没有喝过,但是做了一个鸡尾酒主题交互伞?喜欢么?想自己试一试不?可以私信我要源代码哦。对了,在此声明,此分享不是商业作品,非成套售卖品,感兴趣的可以私信我分享更多细节和资料,然后自己动手做一个。
#include <SPI.h>
#include <SD.h>
#include "LcDef.h"
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(4, 6, 9, 11, 12, 13);
File myFile;
Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver(0x40);
Adafruit_PWMServoDriver pwm2 = Adafruit_PWMServoDriver(0x41);
Adafruit_PWMServoDriver pwm3 = Adafruit_PWMServoDriver(0x42);
Adafruit_PWMServoDriver pwm4 = Adafruit_PWMServoDriver(0x43);
Adafruit_PWMServoDriver pwm5 = Adafruit_PWMServoDriver(0x44);
Adafruit_PWMServoDriver pwm6 = Adafruit_PWMServoDriver(0x45);
Adafruit_PWMServoDriver pwm7 = Adafruit_PWMServoDriver(0x46);
Adafruit_PWMServoDriver pwm8 = Adafruit_PWMServoDriver(0x47);
Adafruit_PWMServoDriver pwm9 = Adafruit_PWMServoDriver(0x48);
Adafruit_PWMServoDriver pwm10 = Adafruit_PWMServoDriver(0x49);
Adafruit_PWMServoDriver servoligne[10] {pwm10,pwm9,pwm8,pwm7,pwm6,pwm5,pwm4,pwm3,pwm2,pwm1};
int degremin=40;
int degremax=120;
int valeurmax=map(degremax,0,180,150,550);
int valeurmin=map(degremin,0,180,150,550);
int tabvaleurmin[10][16];
int tabvaleurmax[10][16];
int angleconsigne=degremin;
#define bouton1on (!digitalRead(24))
#define bouton2on (!digitalRead(26))
#define bouton3on (!digitalRead(28))
#define bouton4on (!digitalRead(30))
byte bouton1onprevious=0;
byte bouton2onprevious=0;
byte bouton3onprevious=0;
byte bouton4onprevious=0;
int valeurbouton1=0;
int valeurbouton2=0;
int valeurbouton3=0;
int valeurbouton4=0;
byte ausuivant=0;
int prochainecol=0;
int angle[10 ] [ 16];
void setup()
{
pinMode(24,INPUT_PULLUP);
pinMode(26,INPUT_PULLUP);
pinMode(28,INPUT_PULLUP);
pinMode(30,INPUT_PULLUP);
for (int x=0;x<=9;x++)
{
servoligne[x].begin();
servoligne[x].setPWMFreq(60);
}
lcd.begin(16, 2);
Serial.begin(9600);
delay(1000);
randomSeed(analogRead(0));
for(int y=0;y<=9; y++) {
for( int x=0;x<=15;x++) {
tabvaleurmin[y][x]=150;
tabvaleurmax[y][x]=550;
}
}
Serial.print("Initializing SD card...");//
lcdaffiche("Initializing SD card...","");
if (!SD.begin(53)) {// *
Serial.println("initialization failed!");//
lcdaffiche("carte SD pas OK","");
delay(4000);
//return;// *
}//
else{//*
Serial.println("initialization done.");//
lcdaffiche("carte SD OK","");
delay(4000);
lecturecartesd("tabmin.txt",tabvaleurmin);
lecturecartesd("tabmax.txt",tabvaleurmax);
}
}
void loop()
{
reglage();
menu();
balle();
eclosion();
propagation();
mouvementsynchrone();
mouvementsinusoidal();
mouvementsinusimage();
lettre("HELLO[[[");
if(quelboutonpese()==4){menu();}
}
网友评论