/*
Sketch based on Cyberlib library from
cyber-place.ru, however due to some hangups
desition were taken to get rid of this library
and use arduino standard libraries
and Adafrruit libraries. LCD module used
just for debuging and is optional, however
many useful information can be hooked to it.
Wiring:
1.8''LCD is just insertewd to MEGA pins 8 -> AREF
2 servos (yaw and pitch) hooked to digital pins 2
and 3 (configurable, just like LCD pins)
Servos powered by 5 volt regulator from external
power supply (this is important not to fry arduino
or your modem)
For video demonstration please visit my youtube:
http://youtu.be/HcA-f-SeI6g
Any references/updates please visit my blog:
www.voltrans.az
*/
//long previousMillis; // Нужно для таймера
//uint8_t LedStep = 0; // Счетчик
int val1 = 0;
int val2 = 0;
//int servoSpeed = 20;
int servoAngle = 20;
int minAngle = 0;
int maxAngle = 180;
//int i;
int q=2;
int w=114;
boolean light_stat;
uint8_t inByte;
uint8_t speed=255; //максимальная скорость по умолчанию
//#define init {D4_Out; D5_Out; D6_Out; D7_Out; D8_Out; D11_Out; D12_Out;}
#define TFT_CS 13
#define TFT_RST 12 // you can also connect this to the Arduino reset
// in which case, set this #define pin to 0!
#define TFT_DC 11
#define TFT_SCLK 9 // set these to be whatever pins you like!
#define TFT_MOSI 10 // set these to be whatever pins you like!
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
const int ledPin = 8;
const int irlight = 46;
const int blastLed = 47;
int backlit = 100; //backlit
switch (inByte) // Смотрим какая команда пришла
{
case 'U': // Серво поднимается
if(val1<maxAngle){
up();
myservo1.attach(24); // attaches the servo on pin 2
for(int i=0;i<servoAngle;i++){
myservo1.write(val1+i); // sets the servo position according to the scaled value
delay(servoAngle);
}
val1=val1+servoAngle;
myservo1.detach(); // detaches the servo on pin 2
}
//up();
// myservo1.write(i -= 10);
break;
case 'J': // Серво опускается
if(val1>minAngle){
dn();
myservo1.attach(24); // attaches the servo on pin 2
for(int i=0;i<servoAngle;i++){
myservo1.write(val1-i); // sets the servo position according to the scaled value
delay(servoAngle);
}
val1=val1-servoAngle;
myservo1.detach(); // detaches the servo on pin 2
}
//dn();
//myservo1.write(i += 10);
break;
case 'H': // Серво поворачивается влево
if(val2<maxAngle){
lt();
myservo2.attach(26); // attaches the servo on pin 2
for(int i=0;i<servoAngle;i++){
myservo2.write(val2+i); // sets the servo position according to the scaled value
delay(servoAngle);
}
val2=val2+servoAngle;
myservo2.detach(); // detaches the servo on pin 2
}
//lt();
//myservo2.write(i += 10);
break;
case 'K': // Серво поворачивается вправо
if(val2>minAngle){
rt();
myservo2.attach(26); // attaches the servo on pin 2
for(int i=0;i<servoAngle;i++){
myservo2.write(val2-i); // sets the servo position according to the scaled value
delay(servoAngle);
}
val2=val2-servoAngle;
myservo2.detach(); // detaches the servo on pin 2
}
//rt();
//myservo2.write(i -= 10);
break;
Единственное, кто нить может подсказать как подключить ардуино pro mini минуя USB порт, что то читал через RX TX, но без подробностей, если кто знает опишите...если получится подключить минуя USB порт, то я могу его использовать для камеры минуя хаб (нет у нас тут полноценного хаба на усб 2, все, что нашел только усб 1.0 (остальное китайское все равно усб 1.1, хотя любят наврать что усб 2.0)
и тогда все запляшет на полном разрешении, без артефактов....