Jeladó rajza, programja

A program fórumból származik és működik, hiba nélkül fordítható 1.8.7 verzióval. A kapcsolási rajz Arduino nano modulhoz kerül átrajzolásra a jobb érthetőség érdekében. A kapcsolók helyére kell tenni az analóg egységek kétállapotú kimeneti jelét.

Biztosan nem lesz már többet analóg elven működő rádiós kombinált jelző építve, a régebbieket amíg gazdaságos megjavítjuk akik webadomany.hu üzemeltetőjétől szerezték be az elmúlt 5 évbe, de utána le kell cserélni. A 2003-2015 között gyártott eszközöket nem lehet gazdaságosan javítani és alkatrésznek sem használhatók fel.

A programot csak egyszer kell megírni, betölteni 10 másodperc, nem kell bajlódni a sokkal drágább analóg RF tagokkal. Ehhez nagyon olcsón vannak alkatrészek, kész modulokban, egy kis kézügyességgel összerakhatod magadnak a később ide feltöltött információk alapján.

433 MHz adó TX oldal rajza
433 MHz adó TX oldal kapcsolási rajza

A program az UNO R3 modulhoz van írva az alábbi lábkiosztás szerint:

ARDUINO UNO R3 lábkiosztása
ARDUINO UNO R3 modul lábkiosztása

Arduino program:

// TX
#include <VirtualWire.h>
//————————————————— VirtualWire.zip file innen tölthető le
const int buttonPin10 = 0;
const int buttonPin11 = 1;
const int buttonPin0 = 2;
const int buttonPin1 = 3;
const int buttonPin2 = 4;
const int buttonPin3 = 5;
const int buttonPin4 = 6;
const int buttonPin5 = 7;
const int buttonPin6 = 8;
const int buttonPin7 = 9;
const int buttonPin8 = 10;
const int buttonPin9 = 11;
//——————————————————————————–
int buttonState0 = 0;
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int buttonState5 = 0;
int buttonState6 = 0;
int buttonState7 = 0;
int buttonState8 = 0;
int buttonState9 = 0;
int buttonState10 = 0;
int buttonState11 = 0;
//——————————————————————————–
void setup()
{
Serial.begin(9600);
//————————————————- Debugging only
Serial.println(“setup”);
//————————————————- Prints “Setup to the serial monitor”
pinMode(buttonPin0, INPUT);
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);
pinMode(buttonPin4, INPUT);
pinMode(buttonPin5, INPUT);
pinMode(buttonPin6, INPUT);
pinMode(buttonPin7, INPUT);
pinMode(buttonPin8, INPUT);
pinMode(buttonPin9, INPUT);
pinMode(buttonPin10, INPUT);
pinMode(buttonPin11, INPUT);
//—————————————————————————
vw_set_tx_pin(13);
// ———————————————— Sets pin D12 as the TX pin
vw_set_ptt_inverted(true);
// ———————————————— Required for DR3100
vw_setup(4000);
// ———————————————— Bits per sec
}
//—————————————————————————
void loop()
{
buttonState0 = digitalRead(buttonPin0);
buttonState1 = digitalRead(buttonPin1);
buttonState2 = digitalRead(buttonPin2);
buttonState3 = digitalRead(buttonPin3);
buttonState4 = digitalRead(buttonPin4);
buttonState5 = digitalRead(buttonPin5);
buttonState6 = digitalRead(buttonPin6);
buttonState7 = digitalRead(buttonPin7);
buttonState8 = digitalRead(buttonPin8);
buttonState9 = digitalRead(buttonPin9);
buttonState10 = digitalRead(buttonPin10);
buttonState11 = digitalRead(buttonPin11);
//—————————————————————————–
const char *msg0 = “0”;
const char *msg1 = “1”;
const char *msg2 = “2”;
const char *msg3 = “3”;
const char *msg4 = “4”;
const char *msg5 = “5”;
const char *msg6 = “6”;
const char *msg7 = “7”;
const char *msg8 = “8”;
const char *msg9 = “9”;
const char *msg10 = “a”;
const char *msg11 = “b”;
const char *msg12 = “c”;
const char *msg13 = “d”;
const char *msg14 = “e”;
const char *msg15 = “f”;
const char *msg16 = “g”;
const char *msg17 = “h”;
const char *msg18 = “i”;
const char *msg19 = “j”;
const char *msg20 = “k”;
const char *msg21 = “l”;
const char *msg22 = “m”;
const char *msg23 = “n”;
//——————————————————————————-
if (buttonState0 == HIGH)
{
vw_send((uint8_t*)msg0, strlen(msg0));
//—————————————-button 0
vw_wait_tx();
delay(30);
}
else
{
vw_send((uint8_t *)msg1, strlen(msg1));
vw_wait_tx();
}
//——————————————————————————-
if (buttonState1 == HIGH)
{
vw_send((uint8_t *)msg2, strlen(msg2));
//—————————————-button 1
vw_wait_tx();
delay(30);
}
else
{
vw_send((uint8_t *)msg3, strlen(msg3));
vw_wait_tx();
}
//——————————————————————————
if (buttonState2 == HIGH)
{
vw_send((uint8_t *)msg4, strlen(msg4));
//—————————————–button 2
vw_wait_tx();
delay(30);
}
else
{
vw_send((uint8_t *)msg5, strlen(msg5));
vw_wait_tx();
}
//——————————————————————————
if (buttonState3 == HIGH)
{
vw_send((uint8_t *)msg6, strlen(msg6));
//—————————————–button 3
vw_wait_tx();
delay(30);
}
else
{
vw_send((uint8_t *)msg7, strlen(msg7));
vw_wait_tx();
}
//——————————————————————————
if (buttonState4 == HIGH)
{
vw_send((uint8_t *)msg8, strlen(msg8));
//—————————————–button 4
vw_wait_tx();
delay(30);
}
else
{
vw_send((uint8_t *)msg9, strlen(msg9));
vw_wait_tx();
}
//——————————————————————————
if (buttonState5 == HIGH)
{
vw_send((uint8_t *)msg10, strlen(msg10));
//—————————————–button 5
vw_wait_tx();
delay(30);
}
else
{
vw_send((uint8_t *)msg11, strlen(msg11));
vw_wait_tx();
}
//—————————————————————————–
if (buttonState6 == HIGH)
{
vw_send((uint8_t *)msg12, strlen(msg12));
//—————————————–button 6
vw_wait_tx();
delay(30);
}
else
{
vw_send((uint8_t *)msg13, strlen(msg13));
vw_wait_tx();
}
//—————————————————————————-
if (buttonState7 == HIGH)
{
vw_send((uint8_t *)msg14, strlen(msg14));
//——————————————button 7
vw_wait_tx();
delay(30);
}
else
{
vw_send((uint8_t *)msg15, strlen(msg15));
vw_wait_tx();
}
//—————————————————————————
if (buttonState8 == HIGH)
{
vw_send((uint8_t *)msg16, strlen(msg16));
//——————————————button 8
vw_wait_tx();
delay(30); }
else
{
vw_send((uint8_t *)msg17, strlen(msg17));
vw_wait_tx();
}
//————————————————————————–
if (buttonState9 == HIGH)
{
vw_send((uint8_t *)msg18, strlen(msg18));
//——————————————button 9
vw_wait_tx();
delay(30); }
else
{
vw_send((uint8_t *)msg19, strlen(msg19));
vw_wait_tx();
}
//————————————————————————
if (buttonState10 == HIGH)
{
vw_send((uint8_t *)msg20, strlen(msg20));
//——————————————-button 9
vw_wait_tx();
delay(30);
}
else
{
vw_send((uint8_t *)msg21, strlen(msg21));
vw_wait_tx();
}
//———————————————————————–
if (buttonState11 == HIGH)
{
vw_send((uint8_t *)msg22, strlen(msg22));
//button 9
vw_wait_tx();
delay(30);
}
else
{
vw_send((uint8_t *)msg23, strlen(msg23));
vw_wait_tx();
}
}
// end code