Telegram Group & Telegram Channel
Публикуем типовые коды для прошивки плат Arduino для сбросов

🔸 Двойной сброс на Arduino Pro Mini
#include <Servo.h>
Servo _SM1;
bool _gen1I = 0;
bool _gen1O = 0;
unsigned long _gen1P = 0UL;
bool _gen2I = 0;
bool _gen2O = 0;
unsigned long _gen2P = 0UL;
bool _count1I = 0;
int _count1_Value = 0;
int _swi3;
int _swi1;
bool _tim1I = 0;
bool _tim1O = 0;
unsigned long _tim1P = 0UL;
int _swi2;
void setup()
{
_SM1.attach(5); // Пин подключения сервы (тут 5)
}
void loop()
{
//Плата:1
if (((analogRead (1))) >= (800)) // Пин подключения фоторезистора (тут А1). Значение - 800
{
if (_tim1I)
{
if (_isTimer(_tim1P, 100))
{
_tim1O = 1;
}
}
else
{
_tim1I =1;
_tim1P = millis();
}
}
else
{
_tim1O = 0;
_tim1I = 0;
}
if (_tim1O)
{
if (! _count1I)
{
_count1I = 1;
if(_count1_Value < 2)
{
_count1_Value = _count1_Value + 1;
}
}
}
else
{
_count1I = 0;
}
if(_count1_Value >= 2)
{
_count1_Value = 0;
}
if ((_count1_Value) == (0))
{
if (! _gen1I)
{
_gen1I = 1;
_gen1O = 1;
_gen1P = millis();
}
}
else
{
_gen1I = 0;
_gen1O= 0;
}
if (_gen1I && _gen1O) _gen1O = !(_isTimer(_gen1P , 1000));
if ((_count1_Value) == (1))
{
if (! _gen2I)
{
_gen2I = 1;
_gen2O = 1;
_gen2P = millis();
}
}
else
{
_gen2I = 0;
_gen2O= 0;
}
if (_gen2I && _gen2O) _gen2O = !(_isTimer(_gen2P , 1000));
if(_gen2O)
{
_swi2=160; // <--- Левый угол
}
else
{
_swi2=0;
}
if (_gen2O)
{
_SM1.write (_swi2);
}
if(((!(_gen1O)) && (!(_gen2O))))
{
_swi3=80; // <--- Центральное положение
}
else
{
_swi3=0;
}
if (((!(_gen1O)) && (!(_gen2O))))
{
_SM1.write (_swi3);
}
if(_gen1O)
{
_swi1=5; // <--- Правый угол
}
else
{
_swi1=0;
}
if (_gen1O)
{
_SM1.write (_swi1);
}
}
bool _isTimer(unsigned long startTime, unsigned long period)
{
unsigned long currentTime;
currentTime = millis();
if (currentTime>= startTime)
{
return (currentTime>=(startTime + period));
}
else
{
return (currentTime >=(4294967295-startTime+period));
}
}

Умельцы-Фронту



group-telegram.com/ufopenaccess/176
Create:
Last Update:

Публикуем типовые коды для прошивки плат Arduino для сбросов

🔸 Двойной сброс на Arduino Pro Mini

#include <Servo.h>
Servo _SM1;
bool _gen1I = 0;
bool _gen1O = 0;
unsigned long _gen1P = 0UL;
bool _gen2I = 0;
bool _gen2O = 0;
unsigned long _gen2P = 0UL;
bool _count1I = 0;
int _count1_Value = 0;
int _swi3;
int _swi1;
bool _tim1I = 0;
bool _tim1O = 0;
unsigned long _tim1P = 0UL;
int _swi2;
void setup()
{
_SM1.attach(5); // Пин подключения сервы (тут 5)
}
void loop()
{
//Плата:1
if (((analogRead (1))) >= (800)) // Пин подключения фоторезистора (тут А1). Значение - 800
{
if (_tim1I)
{
if (_isTimer(_tim1P, 100))
{
_tim1O = 1;
}
}
else
{
_tim1I =1;
_tim1P = millis();
}
}
else
{
_tim1O = 0;
_tim1I = 0;
}
if (_tim1O)
{
if (! _count1I)
{
_count1I = 1;
if(_count1_Value < 2)
{
_count1_Value = _count1_Value + 1;
}
}
}
else
{
_count1I = 0;
}
if(_count1_Value >= 2)
{
_count1_Value = 0;
}
if ((_count1_Value) == (0))
{
if (! _gen1I)
{
_gen1I = 1;
_gen1O = 1;
_gen1P = millis();
}
}
else
{
_gen1I = 0;
_gen1O= 0;
}
if (_gen1I && _gen1O) _gen1O = !(_isTimer(_gen1P , 1000));
if ((_count1_Value) == (1))
{
if (! _gen2I)
{
_gen2I = 1;
_gen2O = 1;
_gen2P = millis();
}
}
else
{
_gen2I = 0;
_gen2O= 0;
}
if (_gen2I && _gen2O) _gen2O = !(_isTimer(_gen2P , 1000));
if(_gen2O)
{
_swi2=160; // <--- Левый угол
}
else
{
_swi2=0;
}
if (_gen2O)
{
_SM1.write (_swi2);
}
if(((!(_gen1O)) && (!(_gen2O))))
{
_swi3=80; // <--- Центральное положение
}
else
{
_swi3=0;
}
if (((!(_gen1O)) && (!(_gen2O))))
{
_SM1.write (_swi3);
}
if(_gen1O)
{
_swi1=5; // <--- Правый угол
}
else
{
_swi1=0;
}
if (_gen1O)
{
_SM1.write (_swi1);
}
}
bool _isTimer(unsigned long startTime, unsigned long period)
{
unsigned long currentTime;
currentTime = millis();
if (currentTime>= startTime)
{
return (currentTime>=(startTime + period));
}
else
{
return (currentTime >=(4294967295-startTime+period));
}
}

Умельцы-Фронту

BY УФ. Открытый доступ




Share with your friend now:
group-telegram.com/ufopenaccess/176

View MORE
Open in Telegram


Telegram | DID YOU KNOW?

Date: |

But because group chats and the channel features are not end-to-end encrypted, Galperin said user privacy is potentially under threat. So, uh, whenever I hear about Telegram, it’s always in relation to something bad. What gives? Pavel Durov, a billionaire who embraces an all-black wardrobe and is often compared to the character Neo from "the Matrix," funds Telegram through his personal wealth and debt financing. And despite being one of the world's most popular tech companies, Telegram reportedly has only about 30 employees who defer to Durov for most major decisions about the platform. He said that since his platform does not have the capacity to check all channels, it may restrict some in Russia and Ukraine "for the duration of the conflict," but then reversed course hours later after many users complained that Telegram was an important source of information. In the United States, Telegram's lower public profile has helped it mostly avoid high level scrutiny from Congress, but it has not gone unnoticed.
from us


Telegram УФ. Открытый доступ
FROM American