@Старик Похабыч, STM наше всё.
Могу сделать плату с декодером HDMI. Правда эти микросхемы дороговаты.
Могу сделать плату с декодером HDMI. Правда эти микросхемы дороговаты.
#define READ_PIN 2
void setup() {
Serial.begin(9600);
}
bool flag = false;
uint32_t tmr;
void loop() {
bool state = digitalRead(READ_PIN);
if (state && !flag) { // фронт LOW-HIGH
flag = true;
tmr = micros();
}
if (!state && flag) { // фронт HIGH-LOW
flag = false;
// выводим период
Serial.println(micros() - tmr);
}
}
[code]
#define READ_PIN 3
void setup() {
Serial.begin(9600);
}
bool flag = false;
uint32_t tmr;
void loop() {
bool state = digitalRead(READ_PIN);
if (state && !flag) { // фронт LOW-HIGH
flag = true;
tmr = micros();
}
if (!state && flag) { // фронт HIGH-LOW
flag = false;
// выводим период
Serial.println(micros() - tmr);
}
}
[code]
#define READ_PIN 2
void setup() {
Serial.begin(9600);
}
bool flag = false;
uint32_t tmr;
int counter = 0;
void loop() {
bool state = digitalRead(READ_PIN);
if (state && !flag) { // фронт LOW-HIGH
flag = true;
counter++;
}
if (!state && flag) { // фронт HIGH-LOW
flag = false;
}
if (millis() - tmr >= 500) {
long prd = (millis() - tmr) / counter;
counter = 0;
Serial.println(prd); // в миллисекундах
tmr = millis();
}
}
[code]
#define READ_PIN 3
void setup() {
Serial.begin(9600);
}
bool flag = false;
uint32_t tmr;
int counter = 0;
void loop() {
bool state = digitalRead(READ_PIN);
if (state && !flag) { // фронт LOW-HIGH
flag = true;
counter++;
}
if (!state && flag) { // фронт HIGH-LOW
flag = false;
}
if (millis() - tmr >= 500) {
long prd = (millis() - tmr) / counter;
counter = 0;
Serial.println(prd); // в миллисекундах
tmr = millis();
}
}
[code]
#include <Adafruit_NeoPixel.h>
int R,G,B,H,V = 0;
#define PIN 6
//#define VGA_13_H 3
//#define VGA_14_V 2
#define NUMPIXELS 79
Adafruit_NeoPixel strip(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int VGA_1_R = A0;
int VGA_2_G = A1;
int VGA_3_B = A2;
//int VGA_14_V = 2;
//int VGA_13_H = 3;
void setup() {
pinMode(A0,INPUT);
pinMode(A1,INPUT);
pinMode(A2,INPUT);
pinMode(3, INPUT);
pinMode(2, INPUT);
Serial.begin(9600);
strip.begin();
strip.show();
}
void loop() {
R = map( analogRead(A0), 0, 820, 0, 255);
G = map(analogRead(A1), 0, 820, 0, 255);
B = map( analogRead(A2), 0, 820, 0, 255);
//H = digitalRead(3);
//V = digitalRead(2);
//Serial.print("r= ");
//Serial.println( R);
// Serial.print("g= ");
// Serial.println(G);
// Serial.print("b= ");
// Serial.println( B);
// Serial.println(H );
// Serial.println(V );
for (int i =0 ; i < 25 ; i++ ) {
int Matrix0[25] = {27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
strip.setPixelColor( Matrix0[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix1[2] = {26,52};
strip.setPixelColor( Matrix1[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix2[2] = {25,53};
strip.setPixelColor( Matrix2[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix3[2] = {24,54};
strip.setPixelColor( Matrix3[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix4[2] = {23,55};
strip.setPixelColor( Matrix4[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix5[2] = {22,56};
strip.setPixelColor( Matrix5[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix6[2] = {21,57};
strip.setPixelColor( Matrix6[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix7[2] = {20,58};
strip.setPixelColor( Matrix7[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix8[2] = {19,59};
strip.setPixelColor( Matrix8[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix9[2] = {18,60};
strip.setPixelColor( Matrix9[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix10[2] = {17,61};
strip.setPixelColor( Matrix10[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix11[2] = {16,62};
strip.setPixelColor( Matrix11[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix12[2] = {15,63};
strip.setPixelColor( Matrix12[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix13[2] = {14,64};
strip.setPixelColor( Matrix13[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix14[2] = {13,65};
strip.setPixelColor( Matrix14[i], R,G,B);
}
strip.show();
for (int i =0 ; i < 2; i++ ) {
int Matrix15[2] = {12,66};
strip.setPixelColor( Matrix15[i], R,G,B);
}
strip.show();
for (int i = 0 ; i < 24 ; i++ ) {
int Matrix16[24] = {11,10,9,8,7,6,5,4,3,2,1,0,78,77,76,75,74,73,72,71,70,69,68,67};
strip.setPixelColor( Matrix16[i], R,G,B);
}
strip.show();
}
[code]
#include <Adafruit_NeoPixel.h>
float R,G,B,H,V = 0;
#define PIN 6
#define NUMPIXELS 79
Adafruit_NeoPixel strip(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pinMode(A0,INPUT);
pinMode(A1,INPUT);
pinMode(A2,INPUT);
pinMode(3, INPUT);
pinMode(2, INPUT);
// Serial.begin(9600);
strip.begin();
strip.show();
}
void loop() {
R = map( analogRead(A0), 0, 1023, 0, 255);
G = map( analogRead(A1), 0, 1023, 0, 255);
B = map( analogRead(A2), 0, 1023, 0, 255);
H = digitalRead(3);
V = digitalRead(2);
for (int i = 0; i < 79 ; i++) {
int Matrix[79] = {27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,
26, 52,
25, 53,
24, 54,
23, 55,
22, 56,
21, 57,
20, 58,
19, 59,
18, 60,
17, 61,
16, 62,
15, 63,
14, 64,
13, 65,
12, 66,
11,10,9,8,7,6,5,4,3,2, 1, 0, 78,77,76,75,74,73,72,71,70,69,68,67} ;
strip.setPixelColor( Matrix[i], R,G,B);
}
strip.show();
}